Add option to print help to stderr #3289
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some command-line utilities reserve
stdout
for special purposes, for example, acd
frontend might use it to tell the shell where tocd
to. The conflict arises whenclap
prints its help messages tostdout
.App::write_help
can be used to write to an arbitrary stream, but it does not provide colour output.This PR adds
AppSettings::PrintToStderr
to optionally print the help and version messages tostderr
instead ofstdout
. This changes the behaviour of the automatic help and version printing, as well as theApp::print_help
andApp::print_long_help
methods.