From 2974c4ec27422a6eab9c65947c9c824fac12cc38 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Fri, 18 Dec 2015 17:22:17 -0800 Subject: [PATCH] etcdctl: fill out ArgsUsage fields for help USAGE in help now names positional arguments (e.g., "member remove " instead of "member remove [arguments...]") Fixes #4021 --- etcdctl/command/auth_commands.go | 14 ++++--- etcdctl/command/backup_command.go | 5 ++- etcdctl/command/cluster_health.go | 5 ++- etcdctl/command/exec_watch_command.go | 5 ++- etcdctl/command/get_command.go | 5 ++- etcdctl/command/import_snap_command.go | 5 ++- etcdctl/command/ls_command.go | 5 ++- etcdctl/command/member_commands.go | 28 ++++++++------ etcdctl/command/mk_command.go | 5 ++- etcdctl/command/mkdir_command.go | 5 ++- etcdctl/command/rm_command.go | 5 ++- etcdctl/command/rmdir_command.go | 5 ++- etcdctl/command/role_commands.go | 38 ++++++++++-------- etcdctl/command/set_command.go | 5 ++- etcdctl/command/set_dir_command.go | 5 ++- etcdctl/command/update_command.go | 5 ++- etcdctl/command/update_dir_command.go | 5 ++- etcdctl/command/user_commands.go | 53 +++++++++++++++----------- etcdctl/command/watch_command.go | 5 ++- 19 files changed, 121 insertions(+), 87 deletions(-) diff --git a/etcdctl/command/auth_commands.go b/etcdctl/command/auth_commands.go index b03de7ff7..71a708b8f 100644 --- a/etcdctl/command/auth_commands.go +++ b/etcdctl/command/auth_commands.go @@ -29,14 +29,16 @@ func NewAuthCommands() cli.Command { Usage: "overall auth controls", Subcommands: []cli.Command{ { - Name: "enable", - Usage: "enable auth access controls", - Action: actionAuthEnable, + Name: "enable", + Usage: "enable auth access controls", + ArgsUsage: " ", + Action: actionAuthEnable, }, { - Name: "disable", - Usage: "disable auth access controls", - Action: actionAuthDisable, + Name: "disable", + Usage: "disable auth access controls", + ArgsUsage: " ", + Action: actionAuthDisable, }, }, } diff --git a/etcdctl/command/backup_command.go b/etcdctl/command/backup_command.go index 375dac4d6..9fb0b00e0 100644 --- a/etcdctl/command/backup_command.go +++ b/etcdctl/command/backup_command.go @@ -32,8 +32,9 @@ import ( func NewBackupCommand() cli.Command { return cli.Command{ - Name: "backup", - Usage: "backup an etcd directory", + Name: "backup", + Usage: "backup an etcd directory", + ArgsUsage: " ", Flags: []cli.Flag{ cli.StringFlag{Name: "data-dir", Value: "", Usage: "Path to the etcd data dir"}, cli.StringFlag{Name: "backup-dir", Value: "", Usage: "Path to the backup dir"}, diff --git a/etcdctl/command/cluster_health.go b/etcdctl/command/cluster_health.go index 0d6085f56..0e64479de 100644 --- a/etcdctl/command/cluster_health.go +++ b/etcdctl/command/cluster_health.go @@ -30,8 +30,9 @@ import ( func NewClusterHealthCommand() cli.Command { return cli.Command{ - Name: "cluster-health", - Usage: "check the health of the etcd cluster", + Name: "cluster-health", + Usage: "check the health of the etcd cluster", + ArgsUsage: " ", Flags: []cli.Flag{ cli.BoolFlag{Name: "forever", Usage: "forever check the health every 10 second until CTRL+C"}, }, diff --git a/etcdctl/command/exec_watch_command.go b/etcdctl/command/exec_watch_command.go index e4dd0d00b..f6f8a2227 100644 --- a/etcdctl/command/exec_watch_command.go +++ b/etcdctl/command/exec_watch_command.go @@ -30,8 +30,9 @@ import ( // NewExecWatchCommand returns the CLI command for "exec-watch". func NewExecWatchCommand() cli.Command { return cli.Command{ - Name: "exec-watch", - Usage: "watch a key for changes and exec an executable", + Name: "exec-watch", + Usage: "watch a key for changes and exec an executable", + ArgsUsage: " [args...]", Flags: []cli.Flag{ cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"}, cli.BoolFlag{Name: "recursive", Usage: "watch all values for key and child keys"}, diff --git a/etcdctl/command/get_command.go b/etcdctl/command/get_command.go index 484d087c7..1e8f24597 100644 --- a/etcdctl/command/get_command.go +++ b/etcdctl/command/get_command.go @@ -26,8 +26,9 @@ import ( // NewGetCommand returns the CLI command for "get". func NewGetCommand() cli.Command { return cli.Command{ - Name: "get", - Usage: "retrieve the value of a key", + Name: "get", + Usage: "retrieve the value of a key", + ArgsUsage: "", Flags: []cli.Flag{ cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"}, cli.BoolFlag{Name: "quorum", Usage: "require quorum for get request"}, diff --git a/etcdctl/command/import_snap_command.go b/etcdctl/command/import_snap_command.go index 8c7640646..499f14902 100644 --- a/etcdctl/command/import_snap_command.go +++ b/etcdctl/command/import_snap_command.go @@ -36,8 +36,9 @@ type set struct { func NewImportSnapCommand() cli.Command { return cli.Command{ - Name: "import", - Usage: "import a snapshot to a cluster", + Name: "import", + Usage: "import a snapshot to a cluster", + ArgsUsage: " ", Flags: []cli.Flag{ cli.StringFlag{Name: "snap", Value: "", Usage: "Path to the valid etcd 0.4.x snapshot."}, cli.StringSliceFlag{Name: "hidden", Value: new(cli.StringSlice), Usage: "Hidden key spaces to import from snapshot"}, diff --git a/etcdctl/command/ls_command.go b/etcdctl/command/ls_command.go index eed35a5b2..469451f7e 100644 --- a/etcdctl/command/ls_command.go +++ b/etcdctl/command/ls_command.go @@ -23,8 +23,9 @@ import ( func NewLsCommand() cli.Command { return cli.Command{ - Name: "ls", - Usage: "retrieve a directory", + Name: "ls", + Usage: "retrieve a directory", + ArgsUsage: "[key]", Flags: []cli.Flag{ cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"}, cli.BoolFlag{Name: "recursive", Usage: "returns all key names recursively for the given path"}, diff --git a/etcdctl/command/member_commands.go b/etcdctl/command/member_commands.go index ef6decdc9..f20ff7c2f 100644 --- a/etcdctl/command/member_commands.go +++ b/etcdctl/command/member_commands.go @@ -28,24 +28,28 @@ func NewMemberCommand() cli.Command { Usage: "member add, remove and list subcommands", Subcommands: []cli.Command{ { - Name: "list", - Usage: "enumerate existing cluster members", - Action: actionMemberList, + Name: "list", + Usage: "enumerate existing cluster members", + ArgsUsage: " ", + Action: actionMemberList, }, { - Name: "add", - Usage: "add a new member to the etcd cluster", - Action: actionMemberAdd, + Name: "add", + Usage: "add a new member to the etcd cluster", + ArgsUsage: " ", + Action: actionMemberAdd, }, { - Name: "remove", - Usage: "remove an existing member from the etcd cluster", - Action: actionMemberRemove, + Name: "remove", + Usage: "remove an existing member from the etcd cluster", + ArgsUsage: "", + Action: actionMemberRemove, }, { - Name: "update", - Usage: "update an existing member in the etcd cluster", - Action: actionMemberUpdate, + Name: "update", + Usage: "update an existing member in the etcd cluster", + ArgsUsage: " ", + Action: actionMemberUpdate, }, }, } diff --git a/etcdctl/command/mk_command.go b/etcdctl/command/mk_command.go index be9593214..52686005f 100644 --- a/etcdctl/command/mk_command.go +++ b/etcdctl/command/mk_command.go @@ -26,8 +26,9 @@ import ( // NewMakeCommand returns the CLI command for "mk". func NewMakeCommand() cli.Command { return cli.Command{ - Name: "mk", - Usage: "make a new key with a given value", + Name: "mk", + Usage: "make a new key with a given value", + ArgsUsage: " ", Flags: []cli.Flag{ cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, diff --git a/etcdctl/command/mkdir_command.go b/etcdctl/command/mkdir_command.go index 15096e269..2b889b835 100644 --- a/etcdctl/command/mkdir_command.go +++ b/etcdctl/command/mkdir_command.go @@ -25,8 +25,9 @@ import ( // NewMakeDirCommand returns the CLI command for "mkdir". func NewMakeDirCommand() cli.Command { return cli.Command{ - Name: "mkdir", - Usage: "make a new directory", + Name: "mkdir", + Usage: "make a new directory", + ArgsUsage: "", Flags: []cli.Flag{ cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, diff --git a/etcdctl/command/rm_command.go b/etcdctl/command/rm_command.go index 57000bcd4..0ebdee86b 100644 --- a/etcdctl/command/rm_command.go +++ b/etcdctl/command/rm_command.go @@ -24,8 +24,9 @@ import ( // NewRemoveCommand returns the CLI command for "rm". func NewRemoveCommand() cli.Command { return cli.Command{ - Name: "rm", - Usage: "remove a key or a directory", + Name: "rm", + Usage: "remove a key or a directory", + ArgsUsage: "", Flags: []cli.Flag{ cli.BoolFlag{Name: "dir", Usage: "removes the key if it is an empty directory or a key-value pair"}, cli.BoolFlag{Name: "recursive", Usage: "removes the key and all child keys(if it is a directory)"}, diff --git a/etcdctl/command/rmdir_command.go b/etcdctl/command/rmdir_command.go index ecfa7ad11..12f34ce80 100644 --- a/etcdctl/command/rmdir_command.go +++ b/etcdctl/command/rmdir_command.go @@ -24,8 +24,9 @@ import ( // NewRemoveCommand returns the CLI command for "rmdir". func NewRemoveDirCommand() cli.Command { return cli.Command{ - Name: "rmdir", - Usage: "removes the key if it is an empty directory or a key-value pair", + Name: "rmdir", + Usage: "removes the key if it is an empty directory or a key-value pair", + ArgsUsage: "", Action: func(c *cli.Context) { rmdirCommandFunc(c, mustNewKeyAPI(c)) }, diff --git a/etcdctl/command/role_commands.go b/etcdctl/command/role_commands.go index c4f6f2bf6..5d5f6894d 100644 --- a/etcdctl/command/role_commands.go +++ b/etcdctl/command/role_commands.go @@ -31,28 +31,33 @@ func NewRoleCommands() cli.Command { Usage: "role add, grant and revoke subcommands", Subcommands: []cli.Command{ { - Name: "add", - Usage: "add a new role for the etcd cluster", - Action: actionRoleAdd, + Name: "add", + Usage: "add a new role for the etcd cluster", + ArgsUsage: " ", + Action: actionRoleAdd, }, { - Name: "get", - Usage: "get details for a role", - Action: actionRoleGet, + Name: "get", + Usage: "get details for a role", + ArgsUsage: "", + Action: actionRoleGet, }, { - Name: "list", - Usage: "list all roles", - Action: actionRoleList, + Name: "list", + Usage: "list all roles", + ArgsUsage: " ", + Action: actionRoleList, }, { - Name: "remove", - Usage: "remove a role from the etcd cluster", - Action: actionRoleRemove, + Name: "remove", + Usage: "remove a role from the etcd cluster", + ArgsUsage: "", + Action: actionRoleRemove, }, { - Name: "grant", - Usage: "grant path matches to an etcd role", + Name: "grant", + Usage: "grant path matches to an etcd role", + ArgsUsage: "", Flags: []cli.Flag{ cli.StringFlag{Name: "path", Value: "", Usage: "Path granted for the role to access"}, cli.BoolFlag{Name: "read", Usage: "Grant read-only access"}, @@ -62,8 +67,9 @@ func NewRoleCommands() cli.Command { Action: actionRoleGrant, }, { - Name: "revoke", - Usage: "revoke path matches for an etcd role", + Name: "revoke", + Usage: "revoke path matches for an etcd role", + ArgsUsage: "", Flags: []cli.Flag{ cli.StringFlag{Name: "path", Value: "", Usage: "Path revoked for the role to access"}, cli.BoolFlag{Name: "read", Usage: "Revoke read access"}, diff --git a/etcdctl/command/set_command.go b/etcdctl/command/set_command.go index 6c69846b9..9a64a78e9 100644 --- a/etcdctl/command/set_command.go +++ b/etcdctl/command/set_command.go @@ -26,8 +26,9 @@ import ( // NewSetCommand returns the CLI command for "set". func NewSetCommand() cli.Command { return cli.Command{ - Name: "set", - Usage: "set the value of a key", + Name: "set", + Usage: "set the value of a key", + ArgsUsage: " ", Flags: []cli.Flag{ cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, cli.StringFlag{Name: "swap-with-value", Value: "", Usage: "previous value"}, diff --git a/etcdctl/command/set_dir_command.go b/etcdctl/command/set_dir_command.go index 9aa93736c..a5fa4dc2d 100644 --- a/etcdctl/command/set_dir_command.go +++ b/etcdctl/command/set_dir_command.go @@ -22,8 +22,9 @@ import ( // NewSetDirCommand returns the CLI command for "setDir". func NewSetDirCommand() cli.Command { return cli.Command{ - Name: "setdir", - Usage: "create a new or existing directory", + Name: "setdir", + Usage: "create a new or existing directory", + ArgsUsage: "", Flags: []cli.Flag{ cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, diff --git a/etcdctl/command/update_command.go b/etcdctl/command/update_command.go index 18aa07ecf..a61817662 100644 --- a/etcdctl/command/update_command.go +++ b/etcdctl/command/update_command.go @@ -26,8 +26,9 @@ import ( // NewUpdateCommand returns the CLI command for "update". func NewUpdateCommand() cli.Command { return cli.Command{ - Name: "update", - Usage: "update an existing key with a given value", + Name: "update", + Usage: "update an existing key with a given value", + ArgsUsage: " ", Flags: []cli.Flag{ cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, diff --git a/etcdctl/command/update_dir_command.go b/etcdctl/command/update_dir_command.go index 48ea8422d..8e97a83cb 100644 --- a/etcdctl/command/update_dir_command.go +++ b/etcdctl/command/update_dir_command.go @@ -26,8 +26,9 @@ import ( // NewUpdateDirCommand returns the CLI command for "updatedir". func NewUpdateDirCommand() cli.Command { return cli.Command{ - Name: "updatedir", - Usage: "update an existing directory", + Name: "updatedir", + Usage: "update an existing directory", + ArgsUsage: " ", Flags: []cli.Flag{ cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, diff --git a/etcdctl/command/user_commands.go b/etcdctl/command/user_commands.go index ad3dfea09..e03ddc5ee 100644 --- a/etcdctl/command/user_commands.go +++ b/etcdctl/command/user_commands.go @@ -32,41 +32,48 @@ func NewUserCommands() cli.Command { Usage: "user add, grant and revoke subcommands", Subcommands: []cli.Command{ { - Name: "add", - Usage: "add a new user for the etcd cluster", - Action: actionUserAdd, + Name: "add", + Usage: "add a new user for the etcd cluster", + ArgsUsage: "", + Action: actionUserAdd, }, { - Name: "get", - Usage: "get details for a user", - Action: actionUserGet, + Name: "get", + Usage: "get details for a user", + ArgsUsage: "", + Action: actionUserGet, }, { - Name: "list", - Usage: "list all current users", - Action: actionUserList, + Name: "list", + Usage: "list all current users", + ArgsUsage: "", + Action: actionUserList, }, { - Name: "remove", - Usage: "remove a user for the etcd cluster", - Action: actionUserRemove, + Name: "remove", + Usage: "remove a user for the etcd cluster", + ArgsUsage: "", + Action: actionUserRemove, }, { - Name: "grant", - Usage: "grant roles to an etcd user", - Flags: []cli.Flag{cli.StringSliceFlag{Name: "roles", Value: new(cli.StringSlice), Usage: "List of roles to grant or revoke"}}, - Action: actionUserGrant, + Name: "grant", + Usage: "grant roles to an etcd user", + ArgsUsage: "", + Flags: []cli.Flag{cli.StringSliceFlag{Name: "roles", Value: new(cli.StringSlice), Usage: "List of roles to grant or revoke"}}, + Action: actionUserGrant, }, { - Name: "revoke", - Usage: "revoke roles for an etcd user", - Flags: []cli.Flag{cli.StringSliceFlag{Name: "roles", Value: new(cli.StringSlice), Usage: "List of roles to grant or revoke"}}, - Action: actionUserRevoke, + Name: "revoke", + Usage: "revoke roles for an etcd user", + ArgsUsage: "", + Flags: []cli.Flag{cli.StringSliceFlag{Name: "roles", Value: new(cli.StringSlice), Usage: "List of roles to grant or revoke"}}, + Action: actionUserRevoke, }, { - Name: "passwd", - Usage: "change password for a user", - Action: actionUserPasswd, + Name: "passwd", + Usage: "change password for a user", + ArgsUsage: "", + Action: actionUserPasswd, }, }, } diff --git a/etcdctl/command/watch_command.go b/etcdctl/command/watch_command.go index 12574a80e..8bc44b053 100644 --- a/etcdctl/command/watch_command.go +++ b/etcdctl/command/watch_command.go @@ -28,8 +28,9 @@ import ( // NewWatchCommand returns the CLI command for "watch". func NewWatchCommand() cli.Command { return cli.Command{ - Name: "watch", - Usage: "watch a key for changes", + Name: "watch", + Usage: "watch a key for changes", + ArgsUsage: "", Flags: []cli.Flag{ cli.BoolFlag{Name: "forever", Usage: "forever watch a key until CTRL+C"}, cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"},