Skip to content

Commit

Permalink
help: separet usage from argument/flag descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatsuo committed Jul 14, 2014
1 parent b21080e commit a18cc22
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (f *CmdFlags) help() {
fmt.Fprintln(&buf, strings.Join(f.about, "\n"))
fmt.Fprintln(&buf)
}
fmt.Fprintln(&buf, "usage:")
if len(f.argsets) == 0 {
fmt.Fprintln(&buf, f.name)
} else {
Expand All @@ -78,7 +79,9 @@ func (f *CmdFlags) help() {
fmt.Fprintln(&buf, " "+f.name+" "+strings.Join(set, " "))
}
}
fmt.Fprintln(&buf)
if len(f.argdocs) > 0 {
fmt.Fprintln(&buf, "arguments and flags:")
}
for _, argdoc := range f.argdocs {
if len(argdoc) == 0 {
panic("empty argdoc")
Expand Down

0 comments on commit a18cc22

Please sign in to comment.