Просмотр исходного кода

etcdctl: print out key and action when watching recursively

Xiang Li 10 лет назад
Родитель
Сommit
9f9661f513
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      etcdctl/command/watch_command.go

+ 5 - 0
etcdctl/command/watch_command.go

@@ -16,6 +16,7 @@ package command
 
 import (
 	"errors"
+	"fmt"
 	"os"
 	"os/signal"
 
@@ -72,6 +73,10 @@ func watchCommandFunc(c *cli.Context, ki client.KeysAPI) {
 		if resp.Node.Dir {
 			continue
 		}
+		if recursive {
+			fmt.Printf("[%s] %s\n", resp.Action, resp.Node.Key)
+		}
+
 		printResponseKey(resp, c.GlobalString("output"))
 
 		if !forever {