Skip to content

Commit

Permalink
help: update app help render on not subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Sep 3, 2022
1 parent edde870 commit 98ffe1a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,10 @@ func (app *App) showCommandTips(name string) {
}

// AppHelpTemplate help template for app(all commands)
// TODO {{if .HasSubcommands }} {$binName} [global options...] <info>COMMAND</> [--options ...] <info>SUBCOMMAND</> [--options ...] [arguments ...]
// {{end}}
var AppHelpTemplate = `{{.Desc}} (Version: <info>{{.Version}}</>)
<comment>Usage:</>
{$binName} [global options...] <info>COMMAND</> [--options ...] [arguments ...]
{$binName} [global options...] <info>COMMAND</> [--options ...] <info>SUBCOMMAND</> [--options ...] [arguments ...]
{$binName} [global options...] <info>COMMAND</> [--options ...] [arguments ...]{{if .HasSubs }}
{$binName} [global options...] <info>COMMAND</> [--options ...] <info>SUBCOMMAND</> [--options ...] [arguments ...]{{end}}
<comment>Global Options:</>
{{.GOpts}}
Expand All @@ -662,6 +660,7 @@ func (app *App) showApplicationHelp() {
"GOpts": app.gFlags.String(),
// app version
"Version": app.Version,
"HasSubs": app.hasSubcommands,
// always upper first char
"Desc": strutil.UpperFirst(app.Desc),
}, template.FuncMap{
Expand Down

0 comments on commit 98ffe1a

Please sign in to comment.