From e769cd22f63d635fb62535b8de1adabffb0bbbf7 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Thu, 5 Oct 2017 17:49:14 +0200 Subject: [PATCH] command: simplify duplicate code --- command/base.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/command/base.go b/command/base.go index 1ebdca387e..741d0f1021 100644 --- a/command/base.go +++ b/command/base.go @@ -210,21 +210,15 @@ func (c *BaseCommand) helpFlagsFor(f *flag.FlagSet) string { var out bytes.Buffer - firstHTTP := true + if c.hasClientHTTP() || c.hasServerHTTP() { + printTitle(&out, "HTTP API Options") + } if c.hasClientHTTP() { - if firstHTTP { - printTitle(&out, "HTTP API Options") - firstHTTP = false - } httpFlagsClient.VisitAll(func(f *flag.Flag) { printFlag(&out, f) }) } if c.hasServerHTTP() { - if firstHTTP { - printTitle(&out, "HTTP API Options") - firstHTTP = false - } httpFlagsServer.VisitAll(func(f *flag.Flag) { printFlag(&out, f) })