From 61bbb40bff18b154faa7040bc4be38682c7ebe3b Mon Sep 17 00:00:00 2001 From: Karl McGuire Date: Thu, 18 Feb 2021 17:05:28 -0500 Subject: [PATCH] fix SuperFlagHelp newline (#252) --- z/flags.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/z/flags.go b/z/flags.go index 73f0c2b3..16cf18c0 100644 --- a/z/flags.go +++ b/z/flags.go @@ -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 {