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

Reverse help arguments so Click recommends --help instead of -h #84

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

mbafford
Copy link
Contributor

@mbafford mbafford commented Aug 3, 2022

Change to make Click recommend --help instead of -h to avoid conflict with -h (--height) parameter.

I would probably remove -h entirely, but not sure how important maintaining that is.


This is trivial, but tripped me up.

Before this PR:

$ shot-scraper
Usage: shot-scraper shot [OPTIONS] URL
Try 'shot-scraper shot -h' for help.
[...]
$ shot-scraper shot
Usage: shot-scraper shot [OPTIONS] URL
Try 'shot-scraper shot -h' for help.
[...]

The recommendation is to run shot-scraper shot -h for help about the tool, but -h is actually the shortcut for "height":

$ shot-scraper shot -h
Error: Option '-h' requires an argument.
$ shot-scraper shot --help | grep -- -h
  -h, --height INTEGER   Height of browser window and shot - defaults to the

After this PR:

.env/bin/shot-scraper
Usage: shot-scraper shot [OPTIONS] URL
Try 'shot-scraper shot --help' for help.
[...]
$.env/bin/shot-scraper shot
Usage: shot-scraper shot [OPTIONS] URL
Try 'shot-scraper shot --help' for help.
[...]

📚 Documentation preview 📚: https://shot-scraper--84.org.readthedocs.build/en/84/

@simonw
Copy link
Owner

simonw commented Aug 11, 2022

Thanks, this is smart.

@simonw
Copy link
Owner

simonw commented Aug 11, 2022

I think you're right about removing the -h shortcut for --help entirely. I don't think that even counts as a breaking change.

@simonw simonw merged commit 467a6c1 into simonw:main Aug 12, 2022
simonw added a commit that referenced this pull request Sep 12, 2022
simonw added a commit that referenced this pull request Sep 12, 2022
simonw added a commit that referenced this pull request Sep 12, 2022
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

Successfully merging this pull request may close these issues.

2 participants