This changes both --help and --version to return an exit code of 0, indicating that nothing went wrong with the command, which is true.
It also sends the output of --help to stdout instead of stderr, which is the usual behavior for most command-line programs.
This has a few advantages:
1) You can run cellsnp-lite --version in a script with set -o errexit, without needing to turn off error-catching or swallow it with || true.
2) Users can more easily send the help to a pager, like cellsnp-lite -h | less.
3) Less surprising to *nix users.
This changes both
--help
and--version
to return an exit code of 0, indicating that nothing went wrong with the command, which is true.It also sends the output of
--help
to stdout instead of stderr, which is the usual behavior for most command-line programs.This has a few advantages: 1) You can run
cellsnp-lite --version
in a script withset -o errexit
, without needing to turn off error-catching or swallow it with|| true
. 2) Users can more easily send the help to a pager, likecellsnp-lite -h | less
. 3) Less surprising to *nix users.For reference, sections 4.8.1 and 4.8.2 of the GNU guidelines echo this advice: https://www.gnu.org/prep/standards/standards.html#g_t_002d_002dversion