From 0fa3a2a7f81ee4b74dc0eb2efdd7e0af99d27f1e Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Mon, 8 Dec 2025 14:01:37 +0100 Subject: [PATCH] prevent overwrite of RunE Signed-off-by: Christian Richter --- opencloud/pkg/command/root.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/opencloud/pkg/command/root.go b/opencloud/pkg/command/root.go index 91d7d1edf8..a0f42f4b54 100644 --- a/opencloud/pkg/command/root.go +++ b/opencloud/pkg/command/root.go @@ -24,9 +24,14 @@ func Execute() error { for _, fn := range register.Commands { cmd := fn(cfg) - cmd.RunE = func(cmd *cobra.Command, args []string) error { - cmd.Help() - return nil + // if the command has a RunE function, it is a subcommand of root + // if not it is a consumed root command from the services + // wee need to overwrite the RunE function to get the help output there + if cmd.RunE == nil { + cmd.RunE = func(cmd *cobra.Command, args []string) error { + cmd.Help() + return nil + } } app.AddCommand(cmd) }