Skip to content
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

Asking for help with '-h' is not an error #45

Open
ernstki opened this issue Sep 16, 2020 · 3 comments
Open

Asking for help with '-h' is not an error #45

ernstki opened this issue Sep 16, 2020 · 3 comments

Comments

@ernstki
Copy link
Contributor

ernstki commented Sep 16, 2020

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.

@nvie
Copy link
Owner

nvie commented Sep 16, 2020

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.

@ernstki
Copy link
Contributor Author

ernstki commented Sep 17, 2020

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. :)

@nvie
Copy link
Owner

nvie commented Sep 17, 2020

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.

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! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants