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 '-?' as an additional alias for '-h' and '--help', just like 'dotnet -?' #1547

Closed
kzu opened this issue May 14, 2024 · 4 comments · Fixed by #1552
Closed

Add '-?' as an additional alias for '-h' and '--help', just like 'dotnet -?' #1547

kzu opened this issue May 14, 2024 · 4 comments · Fixed by #1552

Comments

@kzu
Copy link
Contributor

kzu commented May 14, 2024

It's second nature for me to just type -? to get help on stuff. Even in the GitHub CLI, typing gh -? (although not an official option to get help) gets you the default help :).

I'd say it's a common enough shorthand for help that it deserves being supported built-in.

@patriksvensson
Copy link
Contributor

Sounds like a reasonable thing to add 👍

@kzu
Copy link
Contributor Author

kzu commented May 17, 2024

Adding it as another alias/name for the Help command fails with Encountered invalid character '?' in option name.

So there are two implementation choices:

  1. Make ? a valid option name in the parser
  2. Convert on the fly from -? to -h before executing the app

Option 1 would make the alias discoverable, but may have unintended side-effects due to adding a character that's currently not valid.

Option 2 is easier to implement, but makes it a hidden feature.

Thoughts @patriksvensson?

For now, the PR has option 2, for simplicity reasons :)

@patriksvensson
Copy link
Contributor

@kzu I have no problem making -? a valid option name. I don't think it will have any unforeseen side effects.

@kzu
Copy link
Contributor Author

kzu commented May 18, 2024

Fixed!

patriksvensson pushed a commit that referenced this issue May 29, 2024
Given that it's quite a common switch and extremely unlikely to be already in use for something else, we can just consider it to be the same as having entered `-h` as an arg.

This adds the `?` as a valid option character name.

Fixes #1547
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done 🚀
Development

Successfully merging a pull request may close this issue.

2 participants