Skip to content

Commit

Permalink
Fix printing args with no shorthand in usage
Browse files Browse the repository at this point in the history
  • Loading branch information
electrikmilk committed Jun 30, 2023
1 parent 5f1ad68 commit 347de7b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ func init() {
func PrintUsage() {
var availableFlags string
for a, arg := range registered {
availableFlags += "-" + arg.short
if arg.expectsValue {
availableFlags += "="
if arg.short != "" {
availableFlags += "-" + arg.short
if arg.expectsValue {
availableFlags += "="
}
} else {
availableFlags += "--" + arg.name
}
if len(registered)-1 != a {
availableFlags += " "
Expand Down

0 comments on commit 347de7b

Please sign in to comment.