Browse Source

ctlv3: support del all keys by '--prefix'

Gyu-Ho Lee 9 years ago
parent
commit
fac20b228d
1 changed files with 6 additions and 1 deletions
  1. 6 1
      etcdctl/ctlv3/command/del_command.go

+ 6 - 1
etcdctl/ctlv3/command/del_command.go

@@ -72,7 +72,12 @@ func getDelOp(cmd *cobra.Command, args []string) (string, []clientv3.OpOption) {
 	}
 	}
 
 
 	if delPrefix {
 	if delPrefix {
-		opts = append(opts, clientv3.WithPrefix())
+		if len(key) == 0 {
+			key = "\x00"
+			opts = append(opts, clientv3.WithFromKey())
+		} else {
+			opts = append(opts, clientv3.WithPrefix())
+		}
 	}
 	}
 	if delPrevKV {
 	if delPrevKV {
 		opts = append(opts, clientv3.WithPrevKV())
 		opts = append(opts, clientv3.WithPrevKV())