From 259df25a9663f7fe08b7a4ae0456fa4b80065303 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 3 Nov 2025 13:57:01 +0100 Subject: [PATCH] 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 --- cli/cobra.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cli/cobra.go b/cli/cobra.go index a38bbc0295..a812e02f38 100644 --- a/cli/cobra.go +++ b/cli/cobra.go @@ -350,13 +350,10 @@ func orchestratorSubCommands(cmd *cobra.Command) []*cobra.Command { func allManagementSubCommands(cmd *cobra.Command) []*cobra.Command { cmds := []*cobra.Command{} for _, sub := range cmd.Commands() { - if isPlugin(sub) { - if invalidPluginReason(sub) == "" { - cmds = append(cmds, sub) - } + if invalidPluginReason(sub) != "" { continue } - if sub.IsAvailableCommand() && sub.HasSubCommands() { + if sub.IsAvailableCommand() && (isPlugin(sub) || sub.HasSubCommands()) { cmds = append(cmds, sub) } }