etcdctl/ctlv3: allow empty key

Fix https://github.com/coreos/etcd/issues/5323.
This commit is contained in:
Gyu-Ho Lee 2016-05-13 11:29:58 -07:00
parent 8c953499fa
commit 3ec627d1a8

View File

@ -129,10 +129,18 @@ func getGetOp(cmd *cobra.Command, args []string) (string, []clientv3.OpOption) {
opts = append(opts, clientv3.WithSort(sortByTarget, sortByOrder))
if getPrefix {
opts = append(opts, clientv3.WithPrefix())
if len(key) == 0 {
key = "\x00"
opts = append(opts, clientv3.WithFromKey())
} else {
opts = append(opts, clientv3.WithPrefix())
}
}
if getFromKey {
if len(key) == 0 {
key = "\x00"
}
opts = append(opts, clientv3.WithFromKey())
}