hwtc: host addr is required arg

This commit is contained in:
Stephen McQuay 2018-01-20 08:49:02 -08:00
parent 039819c1f0
commit 9ccfd44724
Signed by: sm
GPG Key ID: 4E4B72F479BA3CE5

View File

@ -10,17 +10,17 @@ import (
pb "mcquay.me/hwt/rpc/hwt"
)
const usage = "hwtc [subject]"
const usage = "hwtc <server address> [subject]"
func main() {
if len(os.Args) < 2 {
if len(os.Args) < 3 {
fmt.Fprintf(os.Stderr, "%v\n", usage)
os.Exit(1)
}
c := pb.NewHelloWorldProtobufClient("http://localhost:8080", &http.Client{})
c := pb.NewHelloWorldProtobufClient(fmt.Sprintf("http://%s", os.Args[1]), &http.Client{})
resp, err := c.Hello(context.Background(), &pb.HelloReq{Subject: strings.Join(os.Args[1:], " ")})
resp, err := c.Hello(context.Background(), &pb.HelloReq{Subject: strings.Join(os.Args[2:], " ")})
if err != nil {
fmt.Fprintf(os.Stderr, "hello: %v\n", err)
os.Exit(1)