Skip to content

Commit 259df25

Browse files
committed
cli: allManagementSubCommands: improve handling of plugin stubs
The allManagementSubCommands function is used to present plugin-commands in the docker --help output; these commands are included in the "management commands" section, but for plugins we don't know if they have sub-commands. However, plugin stubs may be hidden (for placeholders that are not yet loaded), or not be runnable, which was previously ignored. This patch treats plugin-stubs the same as other commands, with the exception of checking if they have subcommands (which is not yet known for plugin-stubs). Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent b5bac44 commit 259df25

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cli/cobra.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,10 @@ func orchestratorSubCommands(cmd *cobra.Command) []*cobra.Command {
350350
func allManagementSubCommands(cmd *cobra.Command) []*cobra.Command {
351351
cmds := []*cobra.Command{}
352352
for _, sub := range cmd.Commands() {
353-
if isPlugin(sub) {
354-
if invalidPluginReason(sub) == "" {
355-
cmds = append(cmds, sub)
356-
}
353+
if invalidPluginReason(sub) != "" {
357354
continue
358355
}
359-
if sub.IsAvailableCommand() && sub.HasSubCommands() {
356+
if sub.IsAvailableCommand() && (isPlugin(sub) || sub.HasSubCommands()) {
360357
cmds = append(cmds, sub)
361358
}
362359
}

0 commit comments

Comments
 (0)