4 ms·
It's not even one extra line of code. usage() should take the output stream as a parameter.
by alextingle 13y ago
It's not even one extra line of code. usage() should take the output stream as a parameter.
- jasomill 13y agoEven so, is it really advantageous to have "foo --help" send usage info to stdout, but for "foo -?" to send "Invalid switch '-?'" followed by usage info to stderr? More importantly, usage information doesn't conform to the structure of ordinary program output, and can therefore be annoying or even dangerous if inadvertently treated as such, so it really, really does belong on stderr for any program whose stdout might reasonably be used as input to another program.
- alextingle 13y agoI appreciate your point, but I still disagree. > usage information doesn't conform to the structure of ordinary program output This is weak. Pretty much every command line program will have multiple flags that change the output in some profound way. Why should --help get special treatment?
- __david__ 13y agoThat's a weird, conceptual argument (and program output is not strongly typed). I just want "program --help | less" to work, especially when there's a lot of options.