From 8e35a4f0d4616f11c322e63dc3ad373fe3d25e0d Mon Sep 17 00:00:00 2001 From: Alex Flint Date: Sun, 31 Mar 2024 10:30:12 -0400 Subject: handle explicit empty placeholders --- usage.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'usage.go') diff --git a/usage.go b/usage.go index a9f9844..43af31e 100644 --- a/usage.go +++ b/usage.go @@ -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 -- cgit v1.2.3