forked from mirror/cobra
trim trailing whitespace
This commit is contained in:
parent
4b86c66ef2
commit
5f83d08ae0
10
command.go
10
command.go
|
@ -248,8 +248,7 @@ func (c *Command) UsageTemplate() string {
|
||||||
if c.HasParent() {
|
if c.HasParent() {
|
||||||
return c.parent.UsageTemplate()
|
return c.parent.UsageTemplate()
|
||||||
} else {
|
} else {
|
||||||
return `{{ $cmd := . }}
|
return `{{ $cmd := . }}Usage:{{if .Runnable}}
|
||||||
Usage: {{if .Runnable}}
|
|
||||||
{{.UseLine}}{{if .HasFlags}} [flags]{{end}}{{end}}{{if .HasSubCommands}}
|
{{.UseLine}}{{if .HasFlags}} [flags]{{end}}{{end}}{{if .HasSubCommands}}
|
||||||
{{ .CommandPath}} [command]{{end}}{{if gt .Aliases 0}}
|
{{ .CommandPath}} [command]{{end}}{{if gt .Aliases 0}}
|
||||||
|
|
||||||
|
@ -260,7 +259,7 @@ Aliases:
|
||||||
Examples:
|
Examples:
|
||||||
{{ .Example }}{{end}}{{ if .HasAvailableSubCommands}}
|
{{ .Example }}{{end}}{{ if .HasAvailableSubCommands}}
|
||||||
|
|
||||||
Available Commands: {{range .Commands}}{{if .IsAvailableCommand}}
|
Available Commands:{{range .Commands}}{{if .IsAvailableCommand}}
|
||||||
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasLocalFlags}}
|
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasLocalFlags}}
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
|
@ -269,7 +268,7 @@ Flags:
|
||||||
Global Flags:
|
Global Flags:
|
||||||
{{.InheritedFlags.FlagUsages}}{{end}}{{if .HasHelpSubCommands}}
|
{{.InheritedFlags.FlagUsages}}{{end}}{{if .HasHelpSubCommands}}
|
||||||
|
|
||||||
Additional help topics: {{range .Commands}}{{if .IsHelpCommand}}
|
Additional help topics:{{range .Commands}}{{if .IsHelpCommand}}
|
||||||
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasSubCommands }}
|
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasSubCommands }}
|
||||||
|
|
||||||
Use "{{.CommandPath}} [command] --help" for more information about a command.
|
Use "{{.CommandPath}} [command] --help" for more information about a command.
|
||||||
|
@ -286,8 +285,7 @@ func (c *Command) HelpTemplate() string {
|
||||||
return c.parent.HelpTemplate()
|
return c.parent.HelpTemplate()
|
||||||
} else {
|
} else {
|
||||||
return `{{with or .Long .Short }}{{. | trim}}{{end}}
|
return `{{with or .Long .Short }}{{. | trim}}{{end}}
|
||||||
{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}
|
{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
|
||||||
`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue