single-cell-genetics / cellsnp-lite

Efficient genotyping bi-allelic SNPs on single cells
https://cellsnp-lite.readthedocs.io
Apache License 2.0
124 stars 11 forks source link

--help/--version should exit with status 0 (and write to stdout) #116

Closed jemma-nelson closed 4 months ago

jemma-nelson commented 4 months ago

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.

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

hxj5 commented 4 months ago

Thanks for the PR. I will merge it.