Browse Source

etcdctl: document watch exec in v3

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
Gyu-Ho Lee 8 years ago
parent
commit
e89fc20542
1 changed files with 22 additions and 1 deletions
  1. 22 1
      etcdctl/README.md

+ 22 - 1
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] <key or prefix>\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 \<subcommand\>
 
 LEASE provides commands for key lease management.