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

pull/315/head
Jeff Mitchell 6 years ago committed by GitHub
parent 1f065316ee
commit b8c8d29008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -94,20 +94,25 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
Func: "list",
}, nil
},
"auth-methods password": func() (cli.Command, error) {
"auth-methods create": func() (cli.Command, error) {
return &authmethods.Command{
Command: base.NewCommand(ui),
Func: "password",
Func: "create",
}, nil
},
"auth-methods password create": func() (cli.Command, error) {
"auth-methods create password": func() (cli.Command, error) {
return &authmethods.PasswordCommand{
Command: base.NewCommand(ui),
Func: "create",
}, nil
},
"auth-methods password update": func() (cli.Command, error) {
"auth-methods update": func() (cli.Command, error) {
return &authmethods.Command{
Command: base.NewCommand(ui),
Func: "update",
}, nil
},
"auth-methods update password": func() (cli.Command, error) {
return &authmethods.PasswordCommand{
Command: base.NewCommand(ui),
Func: "update",
@ -233,20 +238,25 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
Func: "list",
}, nil
},
"host-catalogs static": func() (cli.Command, error) {
"host-catalogs create": func() (cli.Command, error) {
return &hostcatalogs.Command{
Command: base.NewCommand(ui),
Func: "static",
Func: "create",
}, nil
},
"host-catalogs static create": func() (cli.Command, error) {
"host-catalogs create static": func() (cli.Command, error) {
return &hostcatalogs.StaticCommand{
Command: base.NewCommand(ui),
Func: "create",
}, nil
},
"host-catalogs static update": func() (cli.Command, error) {
"host-catalogs update": func() (cli.Command, error) {
return &hostcatalogs.Command{
Command: base.NewCommand(ui),
Func: "update",
}, nil
},
"host-catalogs update static": func() (cli.Command, error) {
return &hostcatalogs.StaticCommand{
Command: base.NewCommand(ui),
Func: "update",
@ -276,20 +286,25 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
Func: "list",
}, nil
},
"host-sets static": func() (cli.Command, error) {
"host-sets create": func() (cli.Command, error) {
return &hostsets.Command{
Command: base.NewCommand(ui),
Func: "static",
Func: "create",
}, nil
},
"host-sets static create": func() (cli.Command, error) {
"host-sets create static": func() (cli.Command, error) {
return &hostsets.StaticCommand{
Command: base.NewCommand(ui),
Func: "create",
}, nil
},
"host-sets static update": func() (cli.Command, error) {
"host-sets update": func() (cli.Command, error) {
return &hostsets.Command{
Command: base.NewCommand(ui),
Func: "update",
}, nil
},
"host-sets update static": func() (cli.Command, error) {
return &hostsets.StaticCommand{
Command: base.NewCommand(ui),
Func: "update",

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

@ -24,10 +24,14 @@ type Command struct {
}
func (c *Command) Synopsis() string {
if c.Func == "static" {
return "Manage static host catalogs within Boundary"
switch c.Func {
case "create":
return "Create host-catalolg resources within Boundary"
case "update":
return "Update host-catalog resources within Boundary"
default:
return common.SynopsisFunc(c.Func, "host-catalog")
}
return common.SynopsisFunc(c.Func, "host-catalog")
}
var flagsMap = map[string][]string{
@ -50,17 +54,29 @@ func (c *Command) Help() string {
"",
" Please see the host-catalogs subcommand help for detailed usage information.",
})
case "static":
case "create":
return base.WrapForHelpText([]string{
"Usage: boundary host-catalogs static [sub command] [options] [args]",
"Usage: boundary host-catalogs create [type] [sub command] [options] [args]",
"",
" This command allows operations on Boundary static-type host-catalog resources. Example:",
" This command allows create operations on Boundary host-catalog resources. Example:",
"",
" Create a static-type host-catalog:",
"",
` $ boundary host-catalogs static create -name prodops -description "For ProdOps usage"`,
` $ boundary host-catalogs create static -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 host-catalogs update [type] [sub command] [options] [args]",
"",
" This command allows update operations on Boundary host-catalog resources. Example:",
"",
" Update a static-type host-catalog:",
"",
` $ boundary host-catalogs update static -id hcst_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 == "static" {
switch c.Func {
case "", "create", "update":
return cli.RunResultHelp
}

@ -26,10 +26,14 @@ type Command struct {
}
func (c *Command) Synopsis() string {
if c.Func == "static" {
return "Manage static host sets within Boundary"
switch c.Func {
case "create":
return "Create host-set resources within Boundary"
case "update":
return "Update host-set resources within Boundary"
default:
return common.SynopsisFunc(c.Func, "host-set")
}
return common.SynopsisFunc(c.Func, "host-set")
}
var flagsMap = map[string][]string{
@ -52,17 +56,29 @@ func (c *Command) Help() string {
"",
" Please see the host-sets subcommand help for detailed usage information.",
})
case "static":
case "create":
return base.WrapForHelpText([]string{
"Usage: boundary host-sets static [sub command] [options] [args]",
"Usage: boundary host-sets create [type] [sub command] [options] [args]",
"",
" This command allows operations on Boundary static-type host-set resources. Example:",
" This command allows create operations on Boundary host-set resources. Example:",
"",
" Create a static-type host-set:",
"",
` $ boundary host-sets static create -name prodops -description "For ProdOps usage"`,
` $ boundary host-sets create static -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 host-sets update [type] [sub command] [options] [args]",
"",
" This command allows update operations on Boundary host-set resources. Example:",
"",
" Update a static-type host-set:",
"",
` $ boundary host-sets update static -id hsst_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()
@ -96,7 +112,8 @@ func (c *Command) AutocompleteFlags() complete.Flags {
}
func (c *Command) Run(args []string) int {
if c.Func == "" || c.Func == "static" {
switch c.Func {
case "", "create", "update":
return cli.RunResultHelp
}

Loading…
Cancel
Save