summaryrefslogtreecommitdiff
path: root/usage.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2017-03-30 14:10:29 -0700
committerGitHub <[email protected]>2017-03-30 14:10:29 -0700
commitcef6506c97e5731da728c374ff3523e481026423 (patch)
treea62391d9019589f6fbc7ab44e74a47f1fd7daf8f /usage.go
parent8111804d1774e2f9e2f7f734a15d2fb9ca684685 (diff)
parent992acaf408ea8b884c7e62b990aba6c11c1715bc (diff)
Merge pull request #54 from k3a/master
Required multiple positionals
Diffstat (limited to 'usage.go')
-rw-r--r--usage.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/usage.go b/usage.go
index bf7fb83..4652b36 100644
--- a/usage.go
+++ b/usage.go
@@ -54,7 +54,13 @@ func (p *Parser) WriteUsage(w io.Writer) {
fmt.Fprint(w, " ")
up := strings.ToUpper(spec.long)
if spec.multiple {
- fmt.Fprintf(w, "[%s [%s ...]]", up, up)
+ if !spec.required {
+ fmt.Fprint(w, "[")
+ }
+ fmt.Fprintf(w, "%s [%s ...]", up, up)
+ if !spec.required {
+ fmt.Fprint(w, "]")
+ }
} else {
fmt.Fprint(w, up)
}