From 6089d723a81a9970f806ac7e198c6dcc1210596e Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Mon, 2 May 2016 19:52:39 -0400 Subject: [PATCH] Use existing `prefixedNames` func --- flag.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/flag.go b/flag.go index 4535b5d..8f124d3 100644 --- a/flag.go +++ b/flag.go @@ -645,24 +645,11 @@ func stringifySliceFlag(usage, name string, defaultVals []string) string { placeholder = defaultPlaceholder } - nameParts := []string{} - for _, part := range strings.Split(name, ",") { - nameParts = append(nameParts, strings.TrimSpace(part)) - } - defaultVal := "" if len(defaultVals) > 0 { defaultVal = fmt.Sprintf(" (default: %s)", strings.Join(defaultVals, ", ")) } usageWithDefault := strings.TrimSpace(fmt.Sprintf("%s%s", usage, defaultVal)) - - if len(nameParts) < 2 { - return fmt.Sprintf("%s%s %s\t%s", prefixFor(nameParts[0]), nameParts[0], - placeholder, usageWithDefault) - } - - return fmt.Sprintf("%s%s %s, %s%s %s\t%s", prefixFor(nameParts[0]), nameParts[0], - placeholder, prefixFor(nameParts[1]), nameParts[1], - placeholder, usageWithDefault) + return fmt.Sprintf("%s\t%s", prefixedNames(name, placeholder), usageWithDefault) }