Is there a way to create command "groups" for custom commands? #6432
Replies: 4 comments 1 reply
-
I like that idea. 👍 |
Beta Was this translation helpful? Give feedback.
-
These groups can definitely be added, but it won't be as useful as in PHP, for example if you have some namespace like Draft code, add this somewhere here: // Add command group in "ddev help"
if val, ok := directives["Group"]; ok && val != "" {
commandToAdd.GroupID = strings.TrimSuffix(val, ":") + ":"
if !rootCmd.ContainsGroup(commandToAdd.GroupID) {
rootCmd.AddGroup(&cobra.Group{ID: commandToAdd.GroupID, Title: commandToAdd.GroupID})
}
} Compile, and add this to some custom command:
It will show in
|
Beta Was this translation helpful? Give feedback.
-
In my opinion, it would be an improvement if the commands could be grouped visually. |
Beta Was this translation helpful? Give feedback.
-
This would be a good suggestion to make in the upstream dependency |
Beta Was this translation helpful? Give feedback.
-
I have several custom commands that I would like to set apart in
ddev help
. Is there a way to "namespace" them so that they appear in groups/sets/categories? An example of such functionality would be Drush, which looks like this:Beta Was this translation helpful? Give feedback.
All reactions