Skip to content

Commit

Permalink
fix SuperFlagHelp newline (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
karlmcguire authored Feb 18, 2021
1 parent 024fba8 commit 61bbb40
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion z/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ func (h *SuperFlagHelp) String() string {
sort.Strings(otherLines)
dls := strings.Join(defaultLines, "")
ols := strings.Join(otherLines, "")
return h.head + "\n" + dls + ols[:len(ols)-1] // remove last newline
if len(ols) == 0 {
// remove last newline
dls = dls[:len(dls)-1]
}
// remove last newline
if len(ols) > 1 {
ols = ols[:len(ols)-1]
}
return h.head + "\n" + dls + ols
}

func parseFlag(flag string) map[string]string {
Expand Down

0 comments on commit 61bbb40

Please sign in to comment.