Browse Source

etcdctl/ctlv2: use latest Action interface

Gyu-Ho Lee 9 years ago
parent
commit
bdca594495

+ 4 - 2
etcdctl/ctlv2/command/auth_commands.go

@@ -44,12 +44,14 @@ func NewAuthCommands() cli.Command {
 	}
 	}
 }
 }
 
 
-func actionAuthEnable(c *cli.Context) {
+func actionAuthEnable(c *cli.Context) error {
 	authEnableDisable(c, true)
 	authEnableDisable(c, true)
+	return nil
 }
 }
 
 
-func actionAuthDisable(c *cli.Context) {
+func actionAuthDisable(c *cli.Context) error {
 	authEnableDisable(c, false)
 	authEnableDisable(c, false)
+	return nil
 }
 }
 
 
 func mustNewAuthAPI(c *cli.Context) client.AuthAPI {
 func mustNewAuthAPI(c *cli.Context) client.AuthAPI {

+ 3 - 1
etcdctl/ctlv2/command/backup_command.go

@@ -46,7 +46,7 @@ func NewBackupCommand() cli.Command {
 }
 }
 
 
 // handleBackup handles a request that intends to do a backup.
 // handleBackup handles a request that intends to do a backup.
-func handleBackup(c *cli.Context) {
+func handleBackup(c *cli.Context) error {
 	var srcWAL string
 	var srcWAL string
 	var destWAL string
 	var destWAL string
 
 
@@ -113,4 +113,6 @@ func handleBackup(c *cli.Context) {
 	if err := neww.SaveSnapshot(walsnap); err != nil {
 	if err := neww.SaveSnapshot(walsnap); err != nil {
 		log.Fatal(err)
 		log.Fatal(err)
 	}
 	}
+
+	return nil
 }
 }

+ 4 - 3
etcdctl/ctlv2/command/cluster_health.go

@@ -40,7 +40,7 @@ func NewClusterHealthCommand() cli.Command {
 	}
 	}
 }
 }
 
 
-func handleClusterHealth(c *cli.Context) {
+func handleClusterHealth(c *cli.Context) error {
 	forever := c.Bool("forever")
 	forever := c.Bool("forever")
 	if forever {
 	if forever {
 		sigch := make(chan os.Signal, 1)
 		sigch := make(chan os.Signal, 1)
@@ -125,9 +125,10 @@ func handleClusterHealth(c *cli.Context) {
 		if !forever {
 		if !forever {
 			if health {
 			if health {
 				os.Exit(ExitSuccess)
 				os.Exit(ExitSuccess)
-			} else {
-				os.Exit(ExitClusterNotHealthy)
+				return nil
 			}
 			}
+			os.Exit(ExitClusterNotHealthy)
+			return nil
 		}
 		}
 
 
 		fmt.Printf("\nnext check after 10 second...\n\n")
 		fmt.Printf("\nnext check after 10 second...\n\n")

+ 2 - 1
etcdctl/ctlv2/command/exec_watch_command.go

@@ -36,8 +36,9 @@ func NewExecWatchCommand() cli.Command {
 			cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"},
 			cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"},
 			cli.BoolFlag{Name: "recursive, r", Usage: "watch all values for key and child keys"},
 			cli.BoolFlag{Name: "recursive, r", Usage: "watch all values for key and child keys"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			execWatchCommandFunc(c, mustNewKeyAPI(c))
 			execWatchCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 2 - 1
etcdctl/ctlv2/command/get_command.go

@@ -33,8 +33,9 @@ func NewGetCommand() cli.Command {
 			cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"},
 			cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"},
 			cli.BoolFlag{Name: "quorum, q", Usage: "require quorum for get request"},
 			cli.BoolFlag{Name: "quorum, q", Usage: "require quorum for get request"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			getCommandFunc(c, mustNewKeyAPI(c))
 			getCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 2 - 1
etcdctl/ctlv2/command/import_snap_command.go

@@ -48,7 +48,7 @@ func NewImportSnapCommand() cli.Command {
 	}
 	}
 }
 }
 
 
-func handleImportSnap(c *cli.Context) {
+func handleImportSnap(c *cli.Context) error {
 	d, err := ioutil.ReadFile(c.String("snap"))
 	d, err := ioutil.ReadFile(c.String("snap"))
 	if err != nil {
 	if err != nil {
 		if c.String("snap") == "" {
 		if c.String("snap") == "" {
@@ -87,6 +87,7 @@ func handleImportSnap(c *cli.Context) {
 	close(setc)
 	close(setc)
 	wg.Wait()
 	wg.Wait()
 	fmt.Printf("finished importing %d keys\n", n)
 	fmt.Printf("finished importing %d keys\n", n)
+	return nil
 }
 }
 
 
 func copyKeys(n *store.NodeExtern, setc chan set) int {
 func copyKeys(n *store.NodeExtern, setc chan set) int {

+ 2 - 1
etcdctl/ctlv2/command/ls_command.go

@@ -32,8 +32,9 @@ func NewLsCommand() cli.Command {
 			cli.BoolFlag{Name: "p", Usage: "append slash (/) to directories"},
 			cli.BoolFlag{Name: "p", Usage: "append slash (/) to directories"},
 			cli.BoolFlag{Name: "quorum, q", Usage: "require quorum for get request"},
 			cli.BoolFlag{Name: "quorum, q", Usage: "require quorum for get request"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			lsCommandFunc(c, mustNewKeyAPI(c))
 			lsCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 9 - 4
etcdctl/ctlv2/command/member_commands.go

@@ -55,7 +55,7 @@ func NewMemberCommand() cli.Command {
 	}
 	}
 }
 }
 
 
-func actionMemberList(c *cli.Context) {
+func actionMemberList(c *cli.Context) error {
 	if len(c.Args()) != 0 {
 	if len(c.Args()) != 0 {
 		fmt.Fprintln(os.Stderr, "No arguments accepted")
 		fmt.Fprintln(os.Stderr, "No arguments accepted")
 		os.Exit(1)
 		os.Exit(1)
@@ -86,9 +86,11 @@ func actionMemberList(c *cli.Context) {
 			fmt.Printf("%s: name=%s peerURLs=%s clientURLs=%s isLeader=%v\n", m.ID, m.Name, strings.Join(m.PeerURLs, ","), strings.Join(m.ClientURLs, ","), isLeader)
 			fmt.Printf("%s: name=%s peerURLs=%s clientURLs=%s isLeader=%v\n", m.ID, m.Name, strings.Join(m.PeerURLs, ","), strings.Join(m.ClientURLs, ","), isLeader)
 		}
 		}
 	}
 	}
+
+	return nil
 }
 }
 
 
-func actionMemberAdd(c *cli.Context) {
+func actionMemberAdd(c *cli.Context) error {
 	args := c.Args()
 	args := c.Args()
 	if len(args) != 2 {
 	if len(args) != 2 {
 		fmt.Fprintln(os.Stderr, "Provide a name and a single member peerURL")
 		fmt.Fprintln(os.Stderr, "Provide a name and a single member peerURL")
@@ -132,9 +134,10 @@ func actionMemberAdd(c *cli.Context) {
 	fmt.Printf("ETCD_NAME=%q\n", newName)
 	fmt.Printf("ETCD_NAME=%q\n", newName)
 	fmt.Printf("ETCD_INITIAL_CLUSTER=%q\n", strings.Join(conf, ","))
 	fmt.Printf("ETCD_INITIAL_CLUSTER=%q\n", strings.Join(conf, ","))
 	fmt.Printf("ETCD_INITIAL_CLUSTER_STATE=\"existing\"\n")
 	fmt.Printf("ETCD_INITIAL_CLUSTER_STATE=\"existing\"\n")
+	return nil
 }
 }
 
 
-func actionMemberRemove(c *cli.Context) {
+func actionMemberRemove(c *cli.Context) error {
 	args := c.Args()
 	args := c.Args()
 	if len(args) != 1 {
 	if len(args) != 1 {
 		fmt.Fprintln(os.Stderr, "Provide a single member ID")
 		fmt.Fprintln(os.Stderr, "Provide a single member ID")
@@ -177,9 +180,10 @@ func actionMemberRemove(c *cli.Context) {
 	}
 	}
 
 
 	fmt.Printf("Removed member %s from cluster\n", removalID)
 	fmt.Printf("Removed member %s from cluster\n", removalID)
+	return nil
 }
 }
 
 
-func actionMemberUpdate(c *cli.Context) {
+func actionMemberUpdate(c *cli.Context) error {
 	args := c.Args()
 	args := c.Args()
 	if len(args) != 2 {
 	if len(args) != 2 {
 		fmt.Fprintln(os.Stderr, "Provide an ID and a list of comma separated peerURL (0xabcd http://example.com,http://example1.com)")
 		fmt.Fprintln(os.Stderr, "Provide an ID and a list of comma separated peerURL (0xabcd http://example.com,http://example1.com)")
@@ -199,4 +203,5 @@ func actionMemberUpdate(c *cli.Context) {
 	}
 	}
 
 
 	fmt.Printf("Updated member with ID %s in cluster\n", mid)
 	fmt.Printf("Updated member with ID %s in cluster\n", mid)
+	return nil
 }
 }

+ 2 - 1
etcdctl/ctlv2/command/mk_command.go

@@ -33,8 +33,9 @@ func NewMakeCommand() cli.Command {
 			cli.BoolFlag{Name: "in-order", Usage: "create in-order key under directory <key>"},
 			cli.BoolFlag{Name: "in-order", Usage: "create in-order key under directory <key>"},
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			mkCommandFunc(c, mustNewKeyAPI(c))
 			mkCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 2 - 1
etcdctl/ctlv2/command/mkdir_command.go

@@ -31,8 +31,9 @@ func NewMakeDirCommand() cli.Command {
 		Flags: []cli.Flag{
 		Flags: []cli.Flag{
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			mkdirCommandFunc(c, mustNewKeyAPI(c), client.PrevNoExist)
 			mkdirCommandFunc(c, mustNewKeyAPI(c), client.PrevNoExist)
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 2 - 1
etcdctl/ctlv2/command/rm_command.go

@@ -33,8 +33,9 @@ func NewRemoveCommand() cli.Command {
 			cli.StringFlag{Name: "with-value", Value: "", Usage: "previous value"},
 			cli.StringFlag{Name: "with-value", Value: "", Usage: "previous value"},
 			cli.IntFlag{Name: "with-index", Value: 0, Usage: "previous index"},
 			cli.IntFlag{Name: "with-index", Value: 0, Usage: "previous index"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			rmCommandFunc(c, mustNewKeyAPI(c))
 			rmCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 2 - 1
etcdctl/ctlv2/command/rmdir_command.go

@@ -27,8 +27,9 @@ func NewRemoveDirCommand() cli.Command {
 		Name:      "rmdir",
 		Name:      "rmdir",
 		Usage:     "removes the key if it is an empty directory or a key-value pair",
 		Usage:     "removes the key if it is an empty directory or a key-value pair",
 		ArgsUsage: "<key>",
 		ArgsUsage: "<key>",
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			rmdirCommandFunc(c, mustNewKeyAPI(c))
 			rmdirCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 13 - 6
etcdctl/ctlv2/command/role_commands.go

@@ -92,7 +92,7 @@ func mustNewAuthRoleAPI(c *cli.Context) client.AuthRoleAPI {
 	return client.NewAuthRoleAPI(hc)
 	return client.NewAuthRoleAPI(hc)
 }
 }
 
 
-func actionRoleList(c *cli.Context) {
+func actionRoleList(c *cli.Context) error {
 	if len(c.Args()) != 0 {
 	if len(c.Args()) != 0 {
 		fmt.Fprintln(os.Stderr, "No arguments accepted")
 		fmt.Fprintln(os.Stderr, "No arguments accepted")
 		os.Exit(1)
 		os.Exit(1)
@@ -109,9 +109,11 @@ func actionRoleList(c *cli.Context) {
 	for _, role := range roles {
 	for _, role := range roles {
 		fmt.Printf("%s\n", role)
 		fmt.Printf("%s\n", role)
 	}
 	}
+
+	return nil
 }
 }
 
 
-func actionRoleAdd(c *cli.Context) {
+func actionRoleAdd(c *cli.Context) error {
 	api, role := mustRoleAPIAndName(c)
 	api, role := mustRoleAPIAndName(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	defer cancel()
 	defer cancel()
@@ -128,9 +130,10 @@ func actionRoleAdd(c *cli.Context) {
 	}
 	}
 
 
 	fmt.Printf("Role %s created\n", role)
 	fmt.Printf("Role %s created\n", role)
+	return nil
 }
 }
 
 
-func actionRoleRemove(c *cli.Context) {
+func actionRoleRemove(c *cli.Context) error {
 	api, role := mustRoleAPIAndName(c)
 	api, role := mustRoleAPIAndName(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	err := api.RemoveRole(ctx, role)
 	err := api.RemoveRole(ctx, role)
@@ -141,14 +144,17 @@ func actionRoleRemove(c *cli.Context) {
 	}
 	}
 
 
 	fmt.Printf("Role %s removed\n", role)
 	fmt.Printf("Role %s removed\n", role)
+	return nil
 }
 }
 
 
-func actionRoleGrant(c *cli.Context) {
+func actionRoleGrant(c *cli.Context) error {
 	roleGrantRevoke(c, true)
 	roleGrantRevoke(c, true)
+	return nil
 }
 }
 
 
-func actionRoleRevoke(c *cli.Context) {
+func actionRoleRevoke(c *cli.Context) error {
 	roleGrantRevoke(c, false)
 	roleGrantRevoke(c, false)
+	return nil
 }
 }
 
 
 func roleGrantRevoke(c *cli.Context, grant bool) {
 func roleGrantRevoke(c *cli.Context, grant bool) {
@@ -214,7 +220,7 @@ func roleGrantRevoke(c *cli.Context, grant bool) {
 	fmt.Printf("Role %s updated\n", role)
 	fmt.Printf("Role %s updated\n", role)
 }
 }
 
 
-func actionRoleGet(c *cli.Context) {
+func actionRoleGet(c *cli.Context) error {
 	api, rolename := mustRoleAPIAndName(c)
 	api, rolename := mustRoleAPIAndName(c)
 
 
 	ctx, cancel := contextWithTotalTimeout(c)
 	ctx, cancel := contextWithTotalTimeout(c)
@@ -233,6 +239,7 @@ func actionRoleGet(c *cli.Context) {
 	for _, v := range role.Permissions.KV.Write {
 	for _, v := range role.Permissions.KV.Write {
 		fmt.Printf("\t%s\n", v)
 		fmt.Printf("\t%s\n", v)
 	}
 	}
+	return nil
 }
 }
 
 
 func mustRoleAPIAndName(c *cli.Context) (client.AuthRoleAPI, string) {
 func mustRoleAPIAndName(c *cli.Context) (client.AuthRoleAPI, string) {

+ 2 - 1
etcdctl/ctlv2/command/set_command.go

@@ -40,8 +40,9 @@ func NewSetCommand() cli.Command {
 			cli.StringFlag{Name: "swap-with-value", Value: "", Usage: "previous value"},
 			cli.StringFlag{Name: "swap-with-value", Value: "", Usage: "previous value"},
 			cli.IntFlag{Name: "swap-with-index", Value: 0, Usage: "previous index"},
 			cli.IntFlag{Name: "swap-with-index", Value: 0, Usage: "previous index"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			setCommandFunc(c, mustNewKeyAPI(c))
 			setCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 2 - 1
etcdctl/ctlv2/command/set_dir_command.go

@@ -28,8 +28,9 @@ func NewSetDirCommand() cli.Command {
 		Flags: []cli.Flag{
 		Flags: []cli.Flag{
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			mkdirCommandFunc(c, mustNewKeyAPI(c), client.PrevIgnore)
 			mkdirCommandFunc(c, mustNewKeyAPI(c), client.PrevIgnore)
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 2 - 1
etcdctl/ctlv2/command/update_command.go

@@ -32,8 +32,9 @@ func NewUpdateCommand() cli.Command {
 		Flags: []cli.Flag{
 		Flags: []cli.Flag{
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			updateCommandFunc(c, mustNewKeyAPI(c))
 			updateCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 2 - 1
etcdctl/ctlv2/command/update_dir_command.go

@@ -31,8 +31,9 @@ func NewUpdateDirCommand() cli.Command {
 		Flags: []cli.Flag{
 		Flags: []cli.Flag{
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 			cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			updatedirCommandFunc(c, mustNewKeyAPI(c))
 			updatedirCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }

+ 14 - 8
etcdctl/ctlv2/command/user_commands.go

@@ -87,7 +87,7 @@ func mustNewAuthUserAPI(c *cli.Context) client.AuthUserAPI {
 	return client.NewAuthUserAPI(hc)
 	return client.NewAuthUserAPI(hc)
 }
 }
 
 
-func actionUserList(c *cli.Context) {
+func actionUserList(c *cli.Context) error {
 	if len(c.Args()) != 0 {
 	if len(c.Args()) != 0 {
 		fmt.Fprintln(os.Stderr, "No arguments accepted")
 		fmt.Fprintln(os.Stderr, "No arguments accepted")
 		os.Exit(1)
 		os.Exit(1)
@@ -104,9 +104,10 @@ func actionUserList(c *cli.Context) {
 	for _, user := range users {
 	for _, user := range users {
 		fmt.Printf("%s\n", user)
 		fmt.Printf("%s\n", user)
 	}
 	}
+	return nil
 }
 }
 
 
-func actionUserAdd(c *cli.Context) {
+func actionUserAdd(c *cli.Context) error {
 	api, userarg := mustUserAPIAndName(c)
 	api, userarg := mustUserAPIAndName(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	defer cancel()
 	defer cancel()
@@ -129,9 +130,10 @@ func actionUserAdd(c *cli.Context) {
 	}
 	}
 
 
 	fmt.Printf("User %s created\n", user)
 	fmt.Printf("User %s created\n", user)
+	return nil
 }
 }
 
 
-func actionUserRemove(c *cli.Context) {
+func actionUserRemove(c *cli.Context) error {
 	api, user := mustUserAPIAndName(c)
 	api, user := mustUserAPIAndName(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	err := api.RemoveUser(ctx, user)
 	err := api.RemoveUser(ctx, user)
@@ -142,9 +144,10 @@ func actionUserRemove(c *cli.Context) {
 	}
 	}
 
 
 	fmt.Printf("User %s removed\n", user)
 	fmt.Printf("User %s removed\n", user)
+	return nil
 }
 }
 
 
-func actionUserPasswd(c *cli.Context) {
+func actionUserPasswd(c *cli.Context) error {
 	api, user := mustUserAPIAndName(c)
 	api, user := mustUserAPIAndName(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	defer cancel()
 	defer cancel()
@@ -166,14 +169,17 @@ func actionUserPasswd(c *cli.Context) {
 	}
 	}
 
 
 	fmt.Printf("Password updated\n")
 	fmt.Printf("Password updated\n")
+	return nil
 }
 }
 
 
-func actionUserGrant(c *cli.Context) {
+func actionUserGrant(c *cli.Context) error {
 	userGrantRevoke(c, true)
 	userGrantRevoke(c, true)
+	return nil
 }
 }
 
 
-func actionUserRevoke(c *cli.Context) {
+func actionUserRevoke(c *cli.Context) error {
 	userGrantRevoke(c, false)
 	userGrantRevoke(c, false)
+	return nil
 }
 }
 
 
 func userGrantRevoke(c *cli.Context, grant bool) {
 func userGrantRevoke(c *cli.Context, grant bool) {
@@ -207,7 +213,7 @@ func userGrantRevoke(c *cli.Context, grant bool) {
 	fmt.Printf("User %s updated\n", user)
 	fmt.Printf("User %s updated\n", user)
 }
 }
 
 
-func actionUserGet(c *cli.Context) {
+func actionUserGet(c *cli.Context) error {
 	api, username := mustUserAPIAndName(c)
 	api, username := mustUserAPIAndName(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	ctx, cancel := contextWithTotalTimeout(c)
 	user, err := api.GetUser(ctx, username)
 	user, err := api.GetUser(ctx, username)
@@ -218,7 +224,7 @@ func actionUserGet(c *cli.Context) {
 	}
 	}
 	fmt.Printf("User: %s\n", user.User)
 	fmt.Printf("User: %s\n", user.User)
 	fmt.Printf("Roles: %s\n", strings.Join(user.Roles, " "))
 	fmt.Printf("Roles: %s\n", strings.Join(user.Roles, " "))
-
+	return nil
 }
 }
 
 
 func mustUserAPIAndName(c *cli.Context) (client.AuthUserAPI, string) {
 func mustUserAPIAndName(c *cli.Context) (client.AuthUserAPI, string) {

+ 2 - 1
etcdctl/ctlv2/command/watch_command.go

@@ -36,8 +36,9 @@ func NewWatchCommand() cli.Command {
 			cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"},
 			cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"},
 			cli.BoolFlag{Name: "recursive, r", Usage: "returns all values for key and child keys"},
 			cli.BoolFlag{Name: "recursive, r", Usage: "returns all values for key and child keys"},
 		},
 		},
-		Action: func(c *cli.Context) {
+		Action: func(c *cli.Context) error {
 			watchCommandFunc(c, mustNewKeyAPI(c))
 			watchCommandFunc(c, mustNewKeyAPI(c))
+			return nil
 		},
 		},
 	}
 	}
 }
 }