etcdctl: fill out ArgsUsage fields for help

USAGE in help now names positional arguments (e.g., "member remove <memberID>"
instead of "member remove [arguments...]")

Fixes #4021
release-2.3
Anthony Romano 2015-12-18 17:22:17 -08:00
parent 9ee9e552e6
commit 2974c4ec27
19 changed files with 121 additions and 87 deletions

View File

@ -31,11 +31,13 @@ func NewAuthCommands() cli.Command {
{
Name: "enable",
Usage: "enable auth access controls",
ArgsUsage: " ",
Action: actionAuthEnable,
},
{
Name: "disable",
Usage: "disable auth access controls",
ArgsUsage: " ",
Action: actionAuthDisable,
},
},

View File

@ -34,6 +34,7 @@ func NewBackupCommand() cli.Command {
return cli.Command{
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"},

View File

@ -32,6 +32,7 @@ func NewClusterHealthCommand() cli.Command {
return cli.Command{
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"},
},

View File

@ -32,6 +32,7 @@ func NewExecWatchCommand() cli.Command {
return cli.Command{
Name: "exec-watch",
Usage: "watch a key for changes and exec an executable",
ArgsUsage: "<key> <command> [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"},

View File

@ -28,6 +28,7 @@ func NewGetCommand() cli.Command {
return cli.Command{
Name: "get",
Usage: "retrieve the value of a key",
ArgsUsage: "<key>",
Flags: []cli.Flag{
cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"},
cli.BoolFlag{Name: "quorum", Usage: "require quorum for get request"},

View File

@ -38,6 +38,7 @@ func NewImportSnapCommand() cli.Command {
return cli.Command{
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"},

View File

@ -25,6 +25,7 @@ func NewLsCommand() cli.Command {
return cli.Command{
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"},

View File

@ -30,21 +30,25 @@ func NewMemberCommand() cli.Command {
{
Name: "list",
Usage: "enumerate existing cluster members",
ArgsUsage: " ",
Action: actionMemberList,
},
{
Name: "add",
Usage: "add a new member to the etcd cluster",
ArgsUsage: "<name> <peerURL>",
Action: actionMemberAdd,
},
{
Name: "remove",
Usage: "remove an existing member from the etcd cluster",
ArgsUsage: "<memberID>",
Action: actionMemberRemove,
},
{
Name: "update",
Usage: "update an existing member in the etcd cluster",
ArgsUsage: "<memberID> <peerURLs>",
Action: actionMemberUpdate,
},
},

View File

@ -28,6 +28,7 @@ func NewMakeCommand() cli.Command {
return cli.Command{
Name: "mk",
Usage: "make a new key with a given value",
ArgsUsage: "<key> <value>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -27,6 +27,7 @@ func NewMakeDirCommand() cli.Command {
return cli.Command{
Name: "mkdir",
Usage: "make a new directory",
ArgsUsage: "<key>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -26,6 +26,7 @@ func NewRemoveCommand() cli.Command {
return cli.Command{
Name: "rm",
Usage: "remove a key or a directory",
ArgsUsage: "<key>",
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)"},

View File

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

View File

@ -33,26 +33,31 @@ func NewRoleCommands() cli.Command {
{
Name: "add",
Usage: "add a new role for the etcd cluster",
ArgsUsage: "<role> ",
Action: actionRoleAdd,
},
{
Name: "get",
Usage: "get details for a role",
ArgsUsage: "<role>",
Action: actionRoleGet,
},
{
Name: "list",
Usage: "list all roles",
ArgsUsage: " ",
Action: actionRoleList,
},
{
Name: "remove",
Usage: "remove a role from the etcd cluster",
ArgsUsage: "<role>",
Action: actionRoleRemove,
},
{
Name: "grant",
Usage: "grant path matches to an etcd role",
ArgsUsage: "<role>",
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"},
@ -64,6 +69,7 @@ func NewRoleCommands() cli.Command {
{
Name: "revoke",
Usage: "revoke path matches for an etcd role",
ArgsUsage: "<role>",
Flags: []cli.Flag{
cli.StringFlag{Name: "path", Value: "", Usage: "Path revoked for the role to access"},
cli.BoolFlag{Name: "read", Usage: "Revoke read access"},

View File

@ -28,6 +28,7 @@ func NewSetCommand() cli.Command {
return cli.Command{
Name: "set",
Usage: "set the value of a key",
ArgsUsage: "<key> <value>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
cli.StringFlag{Name: "swap-with-value", Value: "", Usage: "previous value"},

View File

@ -24,6 +24,7 @@ func NewSetDirCommand() cli.Command {
return cli.Command{
Name: "setdir",
Usage: "create a new or existing directory",
ArgsUsage: "<key>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -28,6 +28,7 @@ func NewUpdateCommand() cli.Command {
return cli.Command{
Name: "update",
Usage: "update an existing key with a given value",
ArgsUsage: "<key> <value>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -28,6 +28,7 @@ func NewUpdateDirCommand() cli.Command {
return cli.Command{
Name: "updatedir",
Usage: "update an existing directory",
ArgsUsage: "<key> <value>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -34,38 +34,45 @@ func NewUserCommands() cli.Command {
{
Name: "add",
Usage: "add a new user for the etcd cluster",
ArgsUsage: "<user>",
Action: actionUserAdd,
},
{
Name: "get",
Usage: "get details for a user",
ArgsUsage: "<user>",
Action: actionUserGet,
},
{
Name: "list",
Usage: "list all current users",
ArgsUsage: "<user>",
Action: actionUserList,
},
{
Name: "remove",
Usage: "remove a user for the etcd cluster",
ArgsUsage: "<user>",
Action: actionUserRemove,
},
{
Name: "grant",
Usage: "grant roles to an etcd user",
ArgsUsage: "<user>",
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",
ArgsUsage: "<user>",
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",
ArgsUsage: "<user>",
Action: actionUserPasswd,
},
},

View File

@ -30,6 +30,7 @@ func NewWatchCommand() cli.Command {
return cli.Command{
Name: "watch",
Usage: "watch a key for changes",
ArgsUsage: "<key>",
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"},