Skip to content

Commit 7494d2c

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]> (cherry picked from commit 259df25) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 5306df3 commit 7494d2c

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
@@ -376,13 +376,10 @@ func orchestratorSubCommands(cmd *cobra.Command) []*cobra.Command {
376376
func allManagementSubCommands(cmd *cobra.Command) []*cobra.Command {
377377
cmds := []*cobra.Command{}
378378
for _, sub := range cmd.Commands() {
379-
if isPlugin(sub) {
380-
if invalidPluginReason(sub) == "" {
381-
cmds = append(cmds, sub)
382-
}
379+
if invalidPluginReason(sub) != "" {
383380
continue
384381
}
385-
if sub.IsAvailableCommand() && sub.HasSubCommands() {
382+
if sub.IsAvailableCommand() && (isPlugin(sub) || sub.HasSubCommands()) {
386383
cmds = append(cmds, sub)
387384
}
388385
}

0 commit comments

Comments
 (0)