etcdctlv3: support endpoint flag

release-2.3
Xiang Li 2015-09-12 22:46:43 -07:00
parent 1de63deca4
commit 121d2b9e9d
5 changed files with 7 additions and 4 deletions

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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(),