Switch ordering of CLI create/update vs static commands (#314)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-08-28 13:31:20 -04:00
1 parent 1f065316ee
commit b8c8d29008
4 files changed
+108 -42

No files matched your search

@@ -24,10 +24,14 @@ type Command struct {
}
func (c *Command) Synopsis() string {
if c.Func == "password" {
return "Manage password auth-methods within Boundary"
switch c.Func {
case "create":
return "Create auth-method resources within Boundary"
case "update":
return "Update auth-method resources within Boundary"
default:
return common.SynopsisFunc(c.Func, "auth-method")
}
return common.SynopsisFunc(c.Func, "auth-method")
}
var flagsMap = map[string][]string{
@@ -50,17 +54,29 @@ func (c *Command) Help() string {
"",
" Please see the auth-methods subcommand help for detailed usage information.",
})
case "password":
case "create":
return base.WrapForHelpText([]string{
"Usage: boundary auth-methods password [sub command] [options] [args]",
"Usage: boundary auth-methods create [type] [sub command] [options] [args]",
"",
" This command allows operations on Boundary password-type auth-method resources. Example:",
" This command allows create operations on Boundary auth-method resources. Example:",
"",
" Create a password-type auth-method:",
"",
` $ boundary auth-methods pasword create -name prodops -description "For ProdOps usage"`,
` $ boundary auth-methods create password -name prodops -description "For ProdOps usage"`,
"",
" Please see the subcommand help for detailed usage information.",
" Please see the typed subcommand help for detailed usage information.",
})
case "update":
return base.WrapForHelpText([]string{
"Usage: boundary auth-methods update [type] [sub command] [options] [args]",
"",
" This command allows update operations on Boundary auth-method resources. Example:",
"",
" Update a password-type auth-method:",
"",
` $ boundary auth-methods update password -id ampw_1234567890 -name devops -description "For DevOps usage"`,
"",
" Please see the typed subcommand help for detailed usage information.",
})
default:
return helpMap[c.Func]() + c.Flags().Help()
@@ -87,7 +103,8 @@ func (c *Command) AutocompleteFlags() complete.Flags {
}
func (c *Command) Run(args []string) int {
if c.Func == "" || c.Func == "password" {
switch c.Func {
case "", "create", "update":
return cli.RunResultHelp
}