git-toolbelt
git-toolbelt copied to clipboard
Asking for help with '-h' is not an error
Vincent, might I convince you that it's not an error to ask for help?
What I mean by that is that -h
output should go to standard out (so it can piped straight into another tool such as grep
or less
without weird redirections) and that git toolbelt-utility -h
should return zero exit status, rather than non-zero.
Probably none of the git-toolbelt utilities fall into this category, but one thing I find personally frustrating is when a program's --help
is pages long, and yet command --help | less
doesn't work (because the output goes to stderr). Now, I know that |& less
or 2>&1 | less
will work, but does everyone?
If the user supplies an invalid argument (or no arguments), then yes, usage >&2; exit 2;;
is warranted. No disagreement there.
I will of course defer to your own philosophical leanings here, and especially if you're of the SemVer persuasion, since this would warrant a 2.0 release, as it breaks the existing git-toolbelt API, as it were, albeit in a benign way.
Thank you, @ernstki! You make an excellent point here, and one that I hadn't really considered like this before. But you're absolutely right, and I would love to change the behavior to what you're suggesting here.
For a long time, I didn't even understand why sometimes program --help | less
or program --help | grep
didn't work, just that it seemed random, and it was aggravating. It wasn't until years after that that I finally had this epiphany. If only it were an epiphany about how to bring about world peace instead. ¯\_(ツ)_/¯
Does it bother you to change this behavior in a point minor release, or do you want to sort of sit on it until 2.0 is looking imminent?
I have a few other PRs here that I've come back to wrap up, but I'm happy to do the twenty minutes of search-and-replace work necessary to make this change across the entire toolbelt. :)
For a long time, I didn't even understand why sometimes
program --help | less
orprogram --help | grep
didn't work, just that it seemed random, and it was aggravating.
Yeah, this will be much better behavior for beginners.
Does it bother you to change this behavior in a point minor release, or do you want to sort of sit on it until 2.0 is looking imminent?
Not at all! I don't really consider this a program change, but like a (minor) update to the help text itself.
I have a few other PRs here that I've come back to wrap up, but I'm happy to do the twenty minutes of search-and-replace work necessary to make this change across the entire toolbelt.
:)
Thank you, that will be very much appreciated! 🙏