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

Add support for a help flag #28

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

masklinn
Copy link
Contributor

@masklinn masklinn commented Nov 15, 2023

When I reach for a binary I don't use often, I usually start with a man $bin or $bin -h (/ --help) to get my bearings and ensure I don't completely misuse the thing. This currently doesn't work with lucky-commit, resulting in a laconic

Error: hash spec contains invalid character '-' (only hex characters and underscores are allowed)

(which admittedly is better than failing silently or doing something silly).

To get the help text it's necessary to be lucky enough to mistakenly give it 2 args, thus failing to match any case. I think it's not great, and having support for a help flag would be nice.

Copy link
Owner

@not-an-aardvark not-an-aardvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, but please fix the CI error (looks like it wants you to run cargo fmt)

@masklinn
Copy link
Contributor Author

Ran fmt, assuming it's good now.

While lucky-commit has a pretty simple interface, because it operates
by side-effects it can be safer to check its behaviour.

Currently, to get the help it's necessary to be lucky enough to
mistakenly give it 2 args, thus failing to match any case. Otherwise,
it will panic if called from not-within-a-repository, and silently
rewrite the HEAD if invoked from one.
@not-an-aardvark not-an-aardvark merged commit 0000000 into not-an-aardvark:main Nov 17, 2023
1 check passed
@masklinn masklinn deleted the help-flag branch November 18, 2023 07:36
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.

3 participants