From 121d2b9e9dbc1a0a2114c69279bbc33d8df85ecd Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Sat, 12 Sep 2015 22:46:43 -0700 Subject: [PATCH] etcdctlv3: support endpoint flag --- etcdctlv3/command/delete_range_command.go | 2 +- etcdctlv3/command/put_command.go | 2 +- etcdctlv3/command/range_command.go | 2 +- etcdctlv3/command/txn_command.go | 2 +- etcdctlv3/main.go | 3 +++ 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/etcdctlv3/command/delete_range_command.go b/etcdctlv3/command/delete_range_command.go index a3aee77b3..8af5d47f6 100644 --- a/etcdctlv3/command/delete_range_command.go +++ b/etcdctlv3/command/delete_range_command.go @@ -44,7 +44,7 @@ func deleteRangeCommandFunc(c *cli.Context) { if len(c.Args()) > 1 { rangeEnd = []byte(c.Args()[1]) } - conn, err := grpc.Dial("127.0.0.1:12379") + conn, err := grpc.Dial(c.GlobalString("endpoint")) if err != nil { panic(err) } diff --git a/etcdctlv3/command/put_command.go b/etcdctlv3/command/put_command.go index 515e65e66..93704c4d5 100644 --- a/etcdctlv3/command/put_command.go +++ b/etcdctlv3/command/put_command.go @@ -41,7 +41,7 @@ func putCommandFunc(c *cli.Context) { key := []byte(c.Args()[0]) value := []byte(c.Args()[1]) - conn, err := grpc.Dial("127.0.0.1:12379") + conn, err := grpc.Dial(c.GlobalString("endpoint")) if err != nil { panic(err) } diff --git a/etcdctlv3/command/range_command.go b/etcdctlv3/command/range_command.go index 0b77dd698..309fc3c53 100644 --- a/etcdctlv3/command/range_command.go +++ b/etcdctlv3/command/range_command.go @@ -44,7 +44,7 @@ func rangeCommandFunc(c *cli.Context) { if len(c.Args()) > 1 { rangeEnd = []byte(c.Args()[1]) } - conn, err := grpc.Dial("127.0.0.1:12379") + conn, err := grpc.Dial(c.GlobalString("endpoint")) if err != nil { panic(err) } diff --git a/etcdctlv3/command/txn_command.go b/etcdctlv3/command/txn_command.go index 2f79f224a..c66a853f6 100644 --- a/etcdctlv3/command/txn_command.go +++ b/etcdctlv3/command/txn_command.go @@ -51,7 +51,7 @@ func txnCommandFunc(c *cli.Context) { next = next(txn, reader) } - conn, err := grpc.Dial("127.0.0.1:12379") + conn, err := grpc.Dial(c.GlobalString("endpoint")) if err != nil { panic(err) } diff --git a/etcdctlv3/main.go b/etcdctlv3/main.go index 0b09152a8..00b162d92 100644 --- a/etcdctlv3/main.go +++ b/etcdctlv3/main.go @@ -27,6 +27,9 @@ func main() { app.Name = "etcdctlv3" app.Version = version.Version app.Usage = "A simple command line client for etcd3." + app.Flags = []cli.Flag{ + cli.StringFlag{Name: "endpoint", Value: "127.0.0.1:2378", Usage: "gRPC endpoint"}, + } app.Commands = []cli.Command{ command.NewRangeCommand(), command.NewPutCommand(),