mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-04 15:27:17 -05:00
prevent overwrite of RunE
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
committed by
Florian Schade
parent
a9b1bea4f8
commit
0fa3a2a7f8
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user