5 ms·
Specific guidance from GNU: https://www.gnu.org/prep/standards/html_node/_002d_002dhelp.html https://www.gnu.org/prep/standards/html_node/_002d_002dhelp.... >
by anderskaseorg 3y ago
Specific guidance from GNU:
https://www.gnu.org/prep/standards/html_node/_002d_002dhelp.html https://www.gnu.org/prep/standards/html_node/_002d_002dhelp....
> The standard --help option should output brief documentation for how to invoke the program, on standard output, then exit successfully.
- rlpb 3y agoI think you missed the point. The guidance you quote doesn't cover the case described.
- dredmorbius 3y agoIMO it does.
- jakewins 3y agoCan you be explicit with what they are missing, I’m clearly missing it as well? OP says please have —help post to stdout, GNU guidance posted above says exact same thing?
- tlamponi 3y ago> Can you be explicit with what they are missing, I’m clearly missing it as well? There are two cases when a CLI program can print its usage 1. when the `--help` option, or often also the short-option `-h`, is passed to the program 2. When the user passes a wrong option to the program, where first the error is printed and then often also the general usage. For 1. the output always should be on stdout, but for 2. the error should be on stderr, and it might be warranted that in that case the usage might be printed on stderr too, so that all is on the same stream. Doing 2. is not a must though, one can also go for an output like: > error message > Try 'program-name --help' for more information This avoids "hiding" the actual error in the often rather big amount of usage-text while still hinting how to get information about what options the program expects and/or accepts.
- consp 3y ago3. With no input when input is required. This is a special case of 2, but is distinctly different since no context can be inferred. In my opinion the program should fail successfully (as in non zero return) since no command was given. I'm highly annoyed when kubectl starts spuwing help text when I forget the command somewhere in a script. Can we also find a "special place" for programs who always output the help text to stderr no matter what and have pages of options? I don't want to be redirecting before beging able to grep...
- jakewins 3y agoYes, the OP is explicitly talking about case 1, and the quoted GNU docs are as well?
- dredmorbius 3y agoThanks, that would be what I was looking for.
- ahoka 3y agoI remember when they have realized that this is a bug for the GNU false utility and changed it. I thought it was funny.
- dredmorbius 3y agoThe original "task failed successfully".