fix: hide help sub-command & persist help flag

This commit is contained in:
decentral1se 2024-07-09 16:43:10 +02:00
parent 878247e46d
commit 4580ea9dc8
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
6 changed files with 24 additions and 11 deletions

View File

@ -5,10 +5,11 @@ import (
) )
var AppCommand = cli.Command{ var AppCommand = cli.Command{
Name: "app", Name: "app",
Aliases: []string{"a"}, Aliases: []string{"a"},
Usage: "Manage apps", Usage: "Manage apps",
ArgsUsage: "<domain>", ArgsUsage: "<domain>",
HideHelpCommand: true,
Commands: []*cli.Command{ Commands: []*cli.Command{
&appBackupCommand, &appBackupCommand,
&appCheckCommand, &appCheckCommand,

View File

@ -20,9 +20,10 @@ import (
) )
var catalogueGenerateCommand = cli.Command{ var catalogueGenerateCommand = cli.Command{
Name: "generate", Name: "generate",
Aliases: []string{"g"}, Aliases: []string{"g"},
Usage: "Generate the recipe catalogue", Usage: "Generate the recipe catalogue",
HideHelpCommand: true,
Flags: []cli.Flag{ Flags: []cli.Flag{
internal.NoInputFlag, internal.NoInputFlag,
internal.PublishFlag, internal.PublishFlag,

View File

@ -167,6 +167,7 @@ func newAbraApp(version, commit string) *cli.Command {
}, },
EnableShellCompletion: true, EnableShellCompletion: true,
UseShortOptionHandling: true, UseShortOptionHandling: true,
HideHelpCommand: true,
ShellComplete: autocomplete.SubcommandComplete, ShellComplete: autocomplete.SubcommandComplete,
} }
@ -194,6 +195,13 @@ func newAbraApp(version, commit string) *cli.Command {
return nil return nil
} }
cli.HelpFlag = &cli.BoolFlag{
Name: "help",
Aliases: []string{"h, H"},
Usage: "Show help",
Persistent: true,
}
return app return app
} }

View File

@ -19,6 +19,7 @@ for you.
Anyone who uses a recipe can become a maintainer. Maintainers typically make Anyone who uses a recipe can become a maintainer. Maintainers typically make
sure the recipe is in good working order and the config upgraded in a timely sure the recipe is in good working order and the config upgraded in a timely
manner.`, manner.`,
HideHelpCommand: true,
Commands: []*cli.Command{ Commands: []*cli.Command{
&recipeFetchCommand, &recipeFetchCommand,
&recipeLintCommand, &recipeLintCommand,

View File

@ -6,9 +6,10 @@ import (
// ServerCommand defines the `abra server` command and its subcommands // ServerCommand defines the `abra server` command and its subcommands
var ServerCommand = cli.Command{ var ServerCommand = cli.Command{
Name: "server", Name: "server",
Aliases: []string{"s"}, Aliases: []string{"s"},
Usage: "Manage servers", Usage: "Manage servers",
HideHelpCommand: true,
Commands: []*cli.Command{ Commands: []*cli.Command{
&serverAddCommand, &serverAddCommand,
&serverListCommand, &serverListCommand,

View File

@ -480,7 +480,8 @@ func newAbraApp(version, commit string) *cli.Command {
\____\___/ \___/| .__/ \____|_|\___/ \__,_|\__,_| \____\___/ \___/| .__/ \____|_|\___/ \__,_|\__,_|
|_| |_|
`, `,
Version: fmt.Sprintf("%s-%s", version, commit[:7]), Version: fmt.Sprintf("%s-%s", version, commit[:7]),
HideHelpCommand: true,
Commands: []*cli.Command{ Commands: []*cli.Command{
&Notify, &Notify,
&UpgradeApp, &UpgradeApp,