diff --git a/etcdctl/README.md b/etcdctl/README.md index 2eeb3e639..c32ab80fd 100644 --- a/etcdctl/README.md +++ b/etcdctl/README.md @@ -337,7 +337,7 @@ Prints the compacted revision. # compacted revision 1234 ``` -### WATCH [options] [key or prefix] [range_end] +### WATCH [options] [key or prefix] [range_end] [--] [exec-command arg1 arg2 ...] Watch watches events stream on keys or prefixes, [key or prefix, range_end) if `range-end` is given. The watch command runs until it encounters an error or is terminated by the user. If range_end is given, it must be lexicographically greater than key or "\x00". @@ -378,6 +378,16 @@ watch [options] \n # bar ``` +Receive events and execute `echo watch event received`: + +```bash +./etcdctl watch foo -- echo watch event received +# PUT +# foo +# bar +# watch event received +``` + ##### Interactive ```bash @@ -392,6 +402,17 @@ watch foo # bar ``` +Receive events and execute `echo watch event received`: + +```bash +./etcdctl watch -i +watch foo -- echo watch event received +# PUT +# foo +# bar +# watch event received +``` + ### LEASE \ LEASE provides commands for key lease management.