flag: single hyphen for flags (-) should be two hyphens (--) in default help/usage CLI output #47114
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
This is an error in Caddy, which uses your standard library for CLI arguments/flags. And as such, I was told to report this here. 🙃
What version of Go are you using (
go version
)?No idea.
Does this issue reproduce with the latest release?
N/A
What operating system and processor architecture are you using (
go env
)?x64_x86
Linux, Fedora Workstation 34
It's Caddy I'm using that uses your standard library here:
Caddy v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=
What did you do?
Consider this command:
Or this horrible typo I made:
What did you expect to see?
It is a very common pattern to use one hyphen for single-letter (short parameters) and two for longer arguments,
See e.g.
https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
various Stackexchange questions (on literally any platform of them 😜 )
https://en.wikipedia.org/wiki/Command-line_interface#Option_conventions_in_Unix-like_systems
As such, I'd propose to always use
--the-two-hypens
when referring to a flag in the help output.What did you see instead?
In the short summary you are writing
--config
e.g., but in the full flag (usually also called parameter, but that is irrelevant IMHO) list below, you list it as-config
, i.e. a single hyphen. Even when your software can handle both, it is somewhat inconsistent and confusing IMHO.Adopted/copied from downstream caddyserver/caddy#4240
The issue seems to lie here, e.g.:
go/src/flag/flag.go
Line 571 in 2701515
go/src/flag/flag.go
Line 963 in 2701515
I.e. there you use the “wrong” number of hyphens.
The text was updated successfully, but these errors were encountered: