Must only add "[flags]" to the end of usage if not yet present

This commit is contained in:
Fabiano Franz
2016-03-15 18:22:20 -03:00
parent 65a708cee0
commit 16b7ba55fb
3 changed files with 36 additions and 8 deletions

View File

@ -263,7 +263,7 @@ func (c *Command) UsageTemplate() string {
return c.parent.UsageTemplate()
} else {
return `Usage:{{if .Runnable}}
{{.UseLine}}{{if .HasFlags}} [flags]{{end}}{{end}}{{if .HasSubCommands}}
{{if .HasFlags}}{{appendIfNotPresent .UseLine "[flags]"}}{{else}}{{.UseLine}}{{end}}{{end}}{{if .HasSubCommands}}
{{ .CommandPath}} [command]{{end}}{{if gt .Aliases 0}}
Aliases: