diff options
| author | Mario Hros <[email protected]> | 2017-03-30 20:32:39 +0200 |
|---|---|---|
| committer | Mario Hros <[email protected]> | 2017-03-30 20:32:39 +0200 |
| commit | 58e62faa3d380dc61dc3be3ce78672081779c0fc (patch) | |
| tree | 65f1eb7fd4a0be1be79561ae98fa6d25915fd0b2 /usage.go | |
| parent | 8111804d1774e2f9e2f7f734a15d2fb9ca684685 (diff) | |
required positional args
Diffstat (limited to 'usage.go')
| -rw-r--r-- | usage.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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) } |
