|
@@ -32,7 +32,6 @@ func NewGetCommand() cli.Command {
|
|
|
Usage: "retrieve the value of a key",
|
|
Usage: "retrieve the value of a key",
|
|
|
Flags: []cli.Flag{
|
|
Flags: []cli.Flag{
|
|
|
cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"},
|
|
cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"},
|
|
|
- cli.BoolFlag{Name: "consistent", Usage: "send request to the leader, thereby guranteeing that any earlier writes will be seen by the read"},
|
|
|
|
|
},
|
|
},
|
|
|
Action: func(c *cli.Context) {
|
|
Action: func(c *cli.Context) {
|
|
|
handleGet(c, getCommandFunc)
|
|
handleGet(c, getCommandFunc)
|
|
@@ -61,16 +60,8 @@ func getCommandFunc(c *cli.Context, client *etcd.Client) (*etcd.Response, error)
|
|
|
return nil, errors.New("Key required")
|
|
return nil, errors.New("Key required")
|
|
|
}
|
|
}
|
|
|
key := c.Args()[0]
|
|
key := c.Args()[0]
|
|
|
- consistent := c.Bool("consistent")
|
|
|
|
|
sorted := c.Bool("sort")
|
|
sorted := c.Bool("sort")
|
|
|
|
|
|
|
|
- // Setup consistency on the client.
|
|
|
|
|
- if consistent {
|
|
|
|
|
- client.SetConsistency(etcd.STRONG_CONSISTENCY)
|
|
|
|
|
- } else {
|
|
|
|
|
- client.SetConsistency(etcd.WEAK_CONSISTENCY)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// Retrieve the value from the server.
|
|
// Retrieve the value from the server.
|
|
|
return client.Get(key, sorted, false)
|
|
return client.Get(key, sorted, false)
|
|
|
}
|
|
}
|