Skip to content

Commit 99fce24

Browse files
committed
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.
1 parent e6a0c3d commit 99fce24

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

command/help.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ func rootHelpFunc(command *cobra.Command, args []string) {
7878
if len(additionalCommands) > 0 {
7979
helpEntries = append(helpEntries, helpEntry{"ADDITIONAL COMMANDS", strings.Join(additionalCommands, "\n")})
8080
}
81-
if command.HasLocalFlags() {
82-
helpEntries = append(helpEntries, helpEntry{"FLAGS", strings.TrimRight(command.LocalFlags().FlagUsages(), "\n")})
81+
flagUsages := strings.TrimRight(command.LocalFlags().FlagUsages(), "\n")
82+
if flagUsages != "" {
83+
helpEntries = append(helpEntries, helpEntry{"FLAGS", flagUsages})
8384
}
8485
if _, ok := command.Annotations["help:arguments"]; ok {
8586
helpEntries = append(helpEntries, helpEntry{"ARGUMENTS", command.Annotations["help:arguments"]})

0 commit comments

Comments
 (0)