Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion plugins/components/conversionlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ func createCommandUsages(cmd Command, convertedStringFlags map[string]StringFlag
}

func getCmdUsageString(cmd Command, namespaces ...string) string {
return strings.Join(append(removeEmptyValues(namespaces), cmd.Name), " ")
name := cmd.Name
if cmd.UsageOptions != nil && cmd.UsageOptions.CommandName != "" {
name = cmd.UsageOptions.CommandName
}
return strings.Join(append(removeEmptyValues(namespaces), name), " ")
}

// Generated usages are based on the command's flags and arguments:
Expand Down
2 changes: 2 additions & 0 deletions plugins/components/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type Command struct {
}

type UsageOptions struct {
// Command name to be used in the usage instead of the actual command name.
CommandName string
// Special cases, each of these will be created as command usage option and the value appended as suffix for the command name.
Usage []string
// If true then the given usages will replace the auto generated usage. Otherwise the given usages will be appended to the auto generated usage.
Expand Down