Fix the check for displaying the command options

This commit is contained in:
Kyle Havlovitz 2017-02-06 23:45:58 -05:00
parent 0f796f0cba
commit e30b9ae5ba
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
1 changed files with 12 additions and 10 deletions

View File

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