From 56ebd5b30f86bbae3e641e5652d71329672a40c5 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 1ebdca387..741d0f102 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) })