diff --git a/etcdctl/README.md b/etcdctl/README.md index 948617d1a..942d23556 100644 --- a/etcdctl/README.md +++ b/etcdctl/README.md @@ -223,12 +223,13 @@ RPC: Txn #### Input Format ```ebnf ::= * "\n" "\n" "\n" - ::= (|||) "\n" + ::= (||||) "\n" ::= "<" | "=" | ">" := ("c"|"create")"("")" ::= ("m"|"mod")"("")" ::= ("val"|"value")"("")" ::= ("ver"|"version")"("")" + ::= "lease("")" ::= * ::= * ::= ((see put, get, del etcdctl command syntax)) "\n" @@ -236,6 +237,7 @@ RPC: Txn ::= (%q formatted string) ::= "\""[0-9]+"\"" ::= "\""[0-9]+"\"" + ::= "\""[0-9]+\"" ``` #### Output diff --git a/etcdctl/ctlv3/command/txn_command.go b/etcdctl/ctlv3/command/txn_command.go index aa8491be3..f809ec88c 100644 --- a/etcdctl/ctlv3/command/txn_command.go +++ b/etcdctl/ctlv3/command/txn_command.go @@ -22,6 +22,7 @@ import ( "strings" "github.com/coreos/etcd/clientv3" + pb "github.com/coreos/etcd/etcdserver/etcdserverpb" "github.com/spf13/cobra" "golang.org/x/net/context" ) @@ -193,6 +194,8 @@ func parseCompare(line string) (*clientv3.Cmp, error) { } case "val", "value": cmp = clientv3.Compare(clientv3.Value(key), op, val) + case "lease": + cmp = clientv3.Compare(clientv3.Cmp{Target: pb.Compare_LEASE}, op, val) default: return nil, fmt.Errorf("malformed comparison: %s (unknown target %s)", line, target) }