-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could have error() output to stderr? #997
Comments
I saw a related article tonight: https://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout |
If you like me to do, I'll change the stdout to stderr. |
Yes, please. |
@crystalfp Are you displaying the help yourself? Or is Commander displaying the help when you call |
It is commander that displays the help.
|
That isn't a bad work-around. When using git-style executable subcommands, the help gets displayed automatically when there are no arguments (unless there is a default command). I was wondering if this was the behaviour you had encountered. I don't think it is appropriate for all Commander messages to go to
Update: adding a quote from GNU standard for
|
This was the only way to have the help text visible when stdout is routed to a file. Anyway, for my specific program, this workaround solved the problem. Ah, and I don't use subcommands. I understand your points. I will continue with my workaround any time I have to redirect stdout. |
An idea for future is is to have the optional parameter to the help calls be the e.g. |
I am currently thinking of making Related PR:#992 |
|
This issue has not had activity in over six months (apart from my updates). It isn't likely to get acted on due to this report. I do agree the help-displayed-as-an-error should go to stderr, but it is not a high priority based on feedback for this item. Feel free to open a new issue if it comes up again, with new information and renewed interest. Thank you for your contributions. |
If the help is displayed due to a usage error then it is displayed on stderr from Commander 7.0.0. |
Just to echo the sentiment presented here #1069, it would be really nice if I could control the output of explicit help requests also. |
That is now supported:
|
From the readme:
I meant that I would like to be able to configure a program such that Edit: Something like:
|
Ah, ok. There is not direct support for that. You could achieve it with a Command subclass and an override. If you have an interesting use case perhaps open a new issue, as you are asking about something different than the original poster in this issue, and not the usual behaviour for utilities: |
Thanks, but I solved in a different way. What I was outputting to stdout now goes to a file. Thanks again for the useful package! |
I have a command line application with the output redirected to a file.
If
mandatory-argument
is not present, commanderhelp()
function is called. Unfortunately the help text goes to the output file due to the redirection. In the commander source file, the help output is hardcoded to go to stdout (line 1147).A workaround is to call
help()
this way:But should be simpler if all commander messages go to stderr and not to stdout.
Thanks for looking!
mario
The text was updated successfully, but these errors were encountered: