From 35a44509fbaac759ee4d837fa3b7623182cb38f9 Mon Sep 17 00:00:00 2001 From: Tobias Schmidt Date: Wed, 8 Apr 2015 17:02:22 -0400 Subject: [PATCH] Improve readability of usage text Separates flag and description by a newline to make it easier to read the flags with long descriptions. --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index a597b5bcf..5b607fd8a 100644 --- a/main.go +++ b/main.go @@ -317,15 +317,15 @@ func usage() { } for _, fl := range groups[groupName] { - format := " -%s=%s: " + format := " -%s=%s" if strings.Contains(fl.DefValue, " ") || fl.DefValue == "" { - format = " -%s=%q: " + format = " -%s=%q" } - flagUsage := fmt.Sprintf(format, fl.Name, fl.DefValue) + flagUsage := fmt.Sprintf(format+lineSep, fl.Name, fl.DefValue) // Format the usage text to not exceed maxLineLength characters per line. words := strings.SplitAfter(fl.Usage, " ") - lineLength := len(flagUsage) + lineLength := len(lineSep) - 1 for _, w := range words { if lineLength+len(w) > maxLineLength { flagUsage += lineSep