go: flag: it is not reasonable not to support "-flag x" for boolean flags.
The flag
standard package says
Command line flag syntax:
-flag
-flag=x
-flag x // non-boolean flags only
One or two minus signs may be used; they are equivalent.
The last form is not permitted for boolean flags because the meaning of the command
cmd -x *
will change if there is a file called 0, false, etc.
You must use the -flag=false form to turn off a boolean flag.
It is not convinced that this exception is only made for boolean flags. Why isn’t it also made for number and string flags? It is the same situation for number and string flags.
IMO, it is totally unnecessary to make this exception. Shell expansions are common and normal. Go packages shouldn’t do anything to avoid some special shell expansions.
[update] What the package documentation should do is to just let users pay attention to shell expansions.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (6 by maintainers)
ls -l false
should list the file named false, not disable long listings.