mirror of
https://github.com/spf13/cobra
synced 2024-11-16 10:47:09 +00:00
Display sub-commands if they are runnable or they have their own sub-commands. Fixes #43
This commit is contained in:
parent
f8e1ec56bd
commit
b6c05a9e39
1 changed files with 15 additions and 15 deletions
|
@ -213,14 +213,14 @@ Aliases:
|
|||
Examples:
|
||||
{{ .Example }}
|
||||
{{end}}{{ if .HasSubCommands}}
|
||||
Available Commands: {{range .Commands}}{{if .Runnable}}
|
||||
Available Commands: {{range .Commands}}{{if or .Runnable .HasSubCommands}}
|
||||
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}
|
||||
{{end}}
|
||||
{{ if .HasLocalFlags}}Flags:
|
||||
{{.LocalFlags.FlagUsages}}{{end}}
|
||||
{{ if .HasAnyPersistentFlags}}Global Flags:
|
||||
{{.AllPersistentFlags.FlagUsages}}{{end}}{{if .HasParent}}{{if and (gt .Commands 0) (gt .Parent.Commands 1) }}
|
||||
Additional help topics: {{if gt .Commands 0 }}{{range .Commands}}{{if not .Runnable}} {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if gt .Parent.Commands 1 }}{{range .Parent.Commands}}{{if .Runnable}}{{if not (eq .Name $cmd.Name) }}{{end}}
|
||||
Additional help topics: {{if gt .Commands 0 }}{{range .Commands}}{{if not .Runnable}} {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if gt .Parent.Commands 1 }}{{range .Parent.Commands}}{{if or .Runnable .HasSubCommands}}{{if not (eq .Name $cmd.Name) }}{{end}}
|
||||
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{end}}
|
||||
{{end}}{{ if .HasSubCommands }}
|
||||
Use "{{.Root.Name}} help [command]" for more information about a command.
|
||||
|
|
Loading…
Reference in a new issue