The documentation is not clear on what the placeholder tag actually does. Digging in the code, I found that it is (I think) only ever used to print help for flags, not cmds or positional args.
This command struct:
type FooCmd struct {
barArg string `arg:"" name:"bar-arg-name" placeholder:"disregarded_placeholder" help:"Help text for barArg."`
bazFlag string `placeholder:"<PLACEHOLDER>" help:"Help text for bazFlag."`
}
gives the following help:
$ foo --help
Usage: foo <bar-arg-name>
[...]
Arguments:
<bar-arg-name> Help text for barArg.
Flags:
--baz-flag=<PLACEHOLDER> Help text for bazFlag.
I was initially under the impression that <bar-arg-name> would actually display as <disregarded_placeholder> instead.
I'm not sure if this is simply a matter of updating the README.md or if this should also be documented in the go docs.
The documentation is not clear on what the
placeholder
tag actually does. Digging in the code, I found that it is (I think) only ever used to print help for flags, notcmd
s or positionalarg
s.This command struct:
gives the following help:
I was initially under the impression that
<bar-arg-name>
would actually display as<disregarded_placeholder>
instead.I'm not sure if this is simply a matter of updating the README.md or if this should also be documented in the go docs.