mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-16 17:45:39 -06:00
override RunE function of root subcommands to ensure that help is shown when no arguments are given
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
committed by
Florian Schade
parent
75bcc548d7
commit
a9b1bea4f8
@@ -23,7 +23,12 @@ func Execute() error {
|
||||
})
|
||||
|
||||
for _, fn := range register.Commands {
|
||||
app.AddCommand(fn(cfg))
|
||||
cmd := fn(cfg)
|
||||
cmd.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
cmd.Help()
|
||||
return nil
|
||||
}
|
||||
app.AddCommand(cmd)
|
||||
}
|
||||
app.SetArgs(os.Args[1:])
|
||||
ctx, _ := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP)
|
||||
|
||||
Reference in New Issue
Block a user