mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +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:
|
Examples:
|
||||||
{{ .Example }}
|
{{ .Example }}
|
||||||
{{end}}{{ if .HasSubCommands}}
|
{{end}}{{ if .HasSubCommands}}
|
||||||
Available Commands: {{range .Commands}}{{if .Runnable}}
|
Available Commands: {{range .Commands}}{{if or .Runnable .HasSubCommands}}
|
||||||
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}
|
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{ if .HasLocalFlags}}Flags:
|
{{ if .HasLocalFlags}}Flags:
|
||||||
{{.LocalFlags.FlagUsages}}{{end}}
|
{{.LocalFlags.FlagUsages}}{{end}}
|
||||||
{{ if .HasAnyPersistentFlags}}Global Flags:
|
{{ if .HasAnyPersistentFlags}}Global Flags:
|
||||||
{{.AllPersistentFlags.FlagUsages}}{{end}}{{if .HasParent}}{{if and (gt .Commands 0) (gt .Parent.Commands 1) }}
|
{{.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}}
|
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{end}}
|
||||||
{{end}}{{ if .HasSubCommands }}
|
{{end}}{{ if .HasSubCommands }}
|
||||||
Use "{{.Root.Name}} help [command]" for more information about a command.
|
Use "{{.Root.Name}} help [command]" for more information about a command.
|
||||||
|
|
Loading…
Add table
Reference in a new issue