feat(cmd): Add help text for storage policy scope funcs
This commit is contained in:
1 parent
5c1ef080cc
commit
b237fe24f1
3 files changed
+42
-1
No files matched your search
@@ -75,6 +75,15 @@ func extraFlagsFuncImpl(c *Command, set *base.FlagSets, f *base.FlagSet) {
|
||||
}
|
||||
|
||||
func extraFlagsHandlingFuncImpl(c *Command, _ *base.FlagSets, opts *[]scopes.Option) bool {
|
||||
// Validate inputs
|
||||
switch c.Func {
|
||||
case "attach-storage-policy":
|
||||
if len(c.flagStoragePolicyId) == 0 {
|
||||
c.UI.Error("No storage policy ID supplied via -storage-policy-id")
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if c.flagSkipAdminRoleCreation {
|
||||
*opts = append(*opts, scopes.WithSkipAdminRoleCreation(c.flagSkipAdminRoleCreation))
|
||||
}
|
||||
@@ -234,3 +243,34 @@ func printItemTable(item *scopes.Scope, resp *api.Response) string {
|
||||
|
||||
return base.WrapForHelpText(ret)
|
||||
}
|
||||
|
||||
func (c *Command) extraHelpFunc(_ map[string]func() string) string {
|
||||
var helpStr string
|
||||
switch c.Func {
|
||||
case "attach-storage-policy":
|
||||
helpStr = base.WrapForHelpText([]string{
|
||||
"Usage: boundary scopes attach-storage-policy [options] [args]",
|
||||
"",
|
||||
" This command allows attaching a storage policy to scope resources. Example:",
|
||||
"",
|
||||
" Attach storage policy to a scope:",
|
||||
"",
|
||||
` $ boundary scopes attach-storage-policy -id o_1234567890 -storage-policy-id pst_1234567890`,
|
||||
"",
|
||||
"",
|
||||
})
|
||||
case "detach-storage-policy":
|
||||
helpStr = base.WrapForHelpText([]string{
|
||||
"Usage: boundary scope detach-storage-policy [options] [args]",
|
||||
"",
|
||||
" This command allows detaching a storage policy from scope resources. Example:",
|
||||
"",
|
||||
" Detach storage policy from scope:",
|
||||
"",
|
||||
` $ boundary scopes detach-storage-policy -id o_1234567890`,
|
||||
"",
|
||||
"",
|
||||
})
|
||||
}
|
||||
return helpStr + c.Flags().Help()
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func (c *Command) Help() string {
|
||||
|
||||
default:
|
||||
|
||||
helpStr = helpMap["base"]()
|
||||
helpStr = c.extraHelpFunc(helpMap)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -576,6 +576,7 @@ var inputStructs = map[string][]*cmdInfo{
|
||||
Pkg: "scopes",
|
||||
StdActions: []string{"create", "read", "update", "delete", "list"},
|
||||
HasExtraCommandVars: true,
|
||||
HasExtraHelpFunc: true,
|
||||
HasId: true,
|
||||
Container: "Scope",
|
||||
HasName: true,
|
||||
|
||||
Reference in new issue
Block a user