help: avoid empty additional help topics header

This commit is contained in:
albertony 2024-08-12 21:45:42 +02:00
parent 498abcc062
commit 62233b4993

View File

@ -219,12 +219,11 @@ Available commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "he
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if and (showLocalFlags .) .HasAvailableLocalFlags}} {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if and (showLocalFlags .) .HasAvailableLocalFlags}}
Flags: Flags:
{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if and (showGlobalFlags .) .HasAvailableInheritedFlags}} {{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if and (showGlobalFlags .) .HasAvailableInheritedFlags}}{{ range flagGroups . }}{{ if .Flags.HasFlags }}
{{ range flagGroups . }}{{ if .Flags.HasFlags }}{{ .Help }} (flag group {{ .Name }}): {{ .Help }} (flag group {{ .Name }}):
{{ .Flags.FlagUsages | trimTrailingWhitespaces}} {{ .Flags.FlagUsages | trimTrailingWhitespaces}}{{ end }}{{ end }}{{end}}{{if .HasHelpSubCommands}}
{{ end }}{{ end }}
Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}} Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}} {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}