command: simplify duplicate code

This commit is contained in:
Frank Schroeder 2017-10-05 17:49:14 +02:00 committed by Frank Schröder
parent a364555121
commit e769cd22f6
1 changed files with 3 additions and 9 deletions

View File

@ -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)
})