From 99fce24fc89d456b653f82444779033d0529a1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 11 Jun 2020 18:50:18 +0200 Subject: [PATCH] Fix FLAGS section showing up empty for `config get/set` This is because `config get/set` both do have a flag, but it's hidden. --- command/help.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/command/help.go b/command/help.go index d49b7a4f9..7f08071de 100644 --- a/command/help.go +++ b/command/help.go @@ -78,8 +78,9 @@ func rootHelpFunc(command *cobra.Command, args []string) { if len(additionalCommands) > 0 { helpEntries = append(helpEntries, helpEntry{"ADDITIONAL COMMANDS", strings.Join(additionalCommands, "\n")}) } - if command.HasLocalFlags() { - helpEntries = append(helpEntries, helpEntry{"FLAGS", strings.TrimRight(command.LocalFlags().FlagUsages(), "\n")}) + flagUsages := strings.TrimRight(command.LocalFlags().FlagUsages(), "\n") + if flagUsages != "" { + helpEntries = append(helpEntries, helpEntry{"FLAGS", flagUsages}) } if _, ok := command.Annotations["help:arguments"]; ok { helpEntries = append(helpEntries, helpEntry{"ARGUMENTS", command.Annotations["help:arguments"]})