-
-
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! 2.4k 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 |
This comment was marked as outdated.
This comment was marked as outdated.
Some people were similarly using multiple longs like Multiple longs not often used in the wild: search |
Regardless of the outcome, I respect thoughtfulness put into this issue/design decision. |
Short version: my latest thinking is to add explicit support for a short-ish option, but with double-dash rather than single dash. Long version There are strong conventions for short options (POSIX) and long options (GNU). I am uncomfortable about supporting a third and non-standard variation with multi-character short option. But I appreciate the author desire for a more memorable short-ish option than a single character. Adding explicit support for a double-dash short-ish option feels like a more pure approach still offering the key benefit. e.g. There are no new behaviours that need to be decided or described for the short-ish option, and it is full featured. Can you embed option value with a short-ish option? Of course, |
In our case we have to maintain compatibility with a suite of existing command line programs. These programs all support various standard options:
This is the standard in this application suite; following POSIX/GNU style would be breaking the local, decades-old standard. While, given the choice, I'd follow usual standards (POSIX/GNU) for command line options, there is not always a choice. Support for single-dash-multiple-letter options would be a welcome feature which, in my opinion, would make |
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: