Skip to content

Commit

Permalink
Indicate which flags needs an argument
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen committed Feb 6, 2016
1 parent bc5809b commit a2bb1bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion handlers_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ func printCommandPrefixHelp(ctx cli.Context, prefix ...string) {
for name, flags := range handler.Flags {
fmt.Printf("\n%s:\n", name)
for _, flag := range flags {
fmt.Printf(" %s (%s)\n", strings.Join(flag.GetPatterns(), ", "), flag.GetDescription())
boolFlag, isBool := flag.(cli.BoolFlag)
if isBool && boolFlag.OmitValue {
fmt.Printf(" %s (%s)\n", strings.Join(flag.GetPatterns(), ", "), flag.GetDescription())
} else {
fmt.Printf(" %s <%s> (%s)\n", strings.Join(flag.GetPatterns(), ", "), flag.GetName(), flag.GetDescription())
}
}
}
}
Expand Down

0 comments on commit a2bb1bb

Please sign in to comment.