@@ -44,6 +44,15 @@ var HelpPrinterCustom helpPrinterCustom = printHelpCustom
4444// VersionPrinter prints the version for the App
4545var VersionPrinter = printVersion
4646
47+ // ShowAppHelp is an action that displays the help
48+ var ShowAppHelp = showAppHelp
49+
50+ // ShowCommandHelp prints help for the given command
51+ var ShowCommandHelp = showCommandHelp
52+
53+ // ShowSubcommandHelp prints help for the given subcommand
54+ var ShowSubcommandHelp = showSubcommandHelp
55+
4756func buildHelpCommand (withAction bool ) * Command {
4857 cmd := & Command {
4958 Name : helpName ,
@@ -131,7 +140,7 @@ func ShowAppHelpAndExit(cmd *Command, exitCode int) {
131140}
132141
133142// ShowAppHelp is an action that displays the help.
134- func ShowAppHelp (cmd * Command ) error {
143+ func showAppHelp (cmd * Command ) error {
135144 tmpl := cmd .CustomRootCommandHelpTemplate
136145 if tmpl == "" {
137146 tracef ("using RootCommandHelpTemplate" )
@@ -270,8 +279,7 @@ func ShowCommandHelpAndExit(ctx context.Context, cmd *Command, command string, c
270279 os .Exit (code )
271280}
272281
273- // ShowCommandHelp prints help for the given command
274- func ShowCommandHelp (ctx context.Context , cmd * Command , commandName string ) error {
282+ func showCommandHelp (ctx context.Context , cmd * Command , commandName string ) error {
275283 for _ , subCmd := range cmd .Commands {
276284 if ! subCmd .HasName (commandName ) {
277285 continue
@@ -322,8 +330,7 @@ func ShowSubcommandHelpAndExit(cmd *Command, exitCode int) {
322330 os .Exit (exitCode )
323331}
324332
325- // ShowSubcommandHelp prints help for the given subcommand
326- func ShowSubcommandHelp (cmd * Command ) error {
333+ func showSubcommandHelp (cmd * Command ) error {
327334 HelpPrinter (cmd .Root ().Writer , SubcommandHelpTemplate , cmd )
328335 return nil
329336}
0 commit comments