From 62233b49934ec37fabd1d6c006ed4410d81c2e20 Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:45:42 +0200 Subject: [PATCH] help: avoid empty additional help topics header --- cmd/help.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/help.go b/cmd/help.go index 53e3d15f4..62228c125 100644 --- a/cmd/help.go +++ b/cmd/help.go @@ -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}} 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 }}): -{{ .Flags.FlagUsages | trimTrailingWhitespaces}} - -{{ end }}{{ end }} +{{ .Help }} (flag group {{ .Name }}): +{{ .Flags.FlagUsages | trimTrailingWhitespaces}}{{ end }}{{ end }}{{end}}{{if .HasHelpSubCommands}} + Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}} {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}