-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Return support for multiple character short options #2307
Comments
Short options with multiple-characters worked more by accident than being intentionally supported. The README was updated in Commander v3 to make the intended single-character explicit and multiple-characters was added to the deprecated documentation in Commander v9. PR #599 added support for embedded option values and moved Commander closer to POSIX conventions which only have a single character for a short option. There have been issues reported where people noted shortcomings in the (unsupported) behaviour: #2211 #2227. Likewise, code added to detect conflicting options did not consider multiple-character short options in #2055. However, multiple character short options have been used in the wild! 2k hits on GitHub with this search If we allow multiple character short options then I want it to be internally supported and not just work by happy coincidence. Do you see multiple-character short options being used in popular command-line utilities you use? (Other than npm, which I know uses its own command-line parsing utility with shorthands.) |
A historical note after some investigation. Before Commander v5, short options with more than 1 character could not actually be used on the command line. In previous versions an option like |
I am continuing to think about this. Using a multiple character short is not standard (POSIX, GNU) and not something I want to promote as a feature. However, I am wondering about allowing it to work in unambiguous cases since being used in the wild and will be annoying for existing users to upgrade. So could be stricter (than before v13):
And otherwise continue to work as previously:
Only lightly documented, since not an encouraged or standard usage (and already gets used despite not being mentioned!) Will be watching for upvotes on this issue! |
I know this change was intentional (#2270), but am hoping the team would reconsider.
A single character can be limiting and result in counterintuitive/weird short parameters.
Real-ish example of where multi-character shorts would be nice:
The text was updated successfully, but these errors were encountered: