From edc353914def587f96e058f5467707086e03666c Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Mon, 6 Feb 2017 23:45:58 -0500 Subject: [PATCH] Fix the check for displaying the command options --- command/meta.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/command/meta.go b/command/meta.go index f60eaf4e23..7218074ba2 100644 --- a/command/meta.go +++ b/command/meta.go @@ -130,16 +130,18 @@ func (m *Meta) helpFlagsFor(f *flag.FlagSet) string { var out bytes.Buffer - if f.NFlag() > 0 { - printTitle(&out, "Command Options") - f.VisitAll(func(f *flag.Flag) { - // Skip HTTP flags as they will be grouped separately - if flagContains(httpFlags, f) { - return - } - printFlag(&out, f) - }) - } + first := true + f.VisitAll(func(f *flag.Flag) { + // Skip HTTP flags as they will be grouped separately + if flagContains(httpFlags, f) { + return + } + if first { + printTitle(&out, "Command Options") + first = false + } + printFlag(&out, f) + }) if m.hasHTTP() { printTitle(&out, "HTTP API Options")