diff options
| author | Alex Flint <[email protected]> | 2024-03-31 10:30:12 -0400 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2024-03-31 10:30:12 -0400 |
| commit | 8e35a4f0d4616f11c322e63dc3ad373fe3d25e0d (patch) | |
| tree | 1ceb580758694cccba16ccac32da825606f5108c /usage.go | |
| parent | 5ec29ce7553bbbe81d99f0900df072eea56b945e (diff) | |
handle explicit empty placeholders
Diffstat (limited to 'usage.go')
| -rw-r--r-- | usage.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -356,7 +356,10 @@ func (p *Parser) lookupCommand(path ...string) (*command, error) { } func synopsis(spec *spec, form string) string { - if spec.cardinality == zero { + // if the user omits the placeholder tag then we pick one automatically, + // but if the user explicitly specifies an empty placeholder then we + // leave out the placeholder in the help message + if spec.cardinality == zero || spec.placeholder == "" { return form } return form + " " + spec.placeholder |
