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

@ -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,
},
},
}

View File

@ -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"},

View File

@ -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"},
},

View File

@ -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: "<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

@ -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: "<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

@ -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"},

View File

@ -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"},

View File

@ -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: "<name> <peerURL>",
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: "<memberID>",
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: "<memberID> <peerURLs>",
Action: actionMemberUpdate,
},
},
}

View File

@ -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: "<key> <value>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -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: "<key>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -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: "<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

@ -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: "<key>",
Action: func(c *cli.Context) {
rmdirCommandFunc(c, mustNewKeyAPI(c))
},

View File

@ -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: "<role> ",
Action: actionRoleAdd,
},
{
Name: "get",
Usage: "get details for a role",
Action: actionRoleGet,
Name: "get",
Usage: "get details for a role",
ArgsUsage: "<role>",
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: "<role>",
Action: actionRoleRemove,
},
{
Name: "grant",
Usage: "grant path matches to an etcd role",
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"},
@ -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: "<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

@ -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: "<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

@ -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: "<key>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -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: "<key> <value>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -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: "<key> <value>",
Flags: []cli.Flag{
cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"},
},

View File

@ -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: "<user>",
Action: actionUserAdd,
},
{
Name: "get",
Usage: "get details for a user",
Action: actionUserGet,
Name: "get",
Usage: "get details for a user",
ArgsUsage: "<user>",
Action: actionUserGet,
},
{
Name: "list",
Usage: "list all current users",
Action: actionUserList,
Name: "list",
Usage: "list all current users",
ArgsUsage: "<user>",
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: "<user>",
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: "<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",
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: "<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",
Action: actionUserPasswd,
Name: "passwd",
Usage: "change password for a user",
ArgsUsage: "<user>",
Action: actionUserPasswd,
},
},
}

View File

@ -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: "<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"},