-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support non-Unix options (e.g. find -exec, bash +O shopt, cmd.exe /c, gcc -Wl,) #2468
Comments
My comment in #1210 speaks of a general solution that would cover the wider case than just single hyphens in long arguments.
We do have It doesn't allow a different separator value. We'd need to create a name, add support for it, and deprecate the existing function (since it name references the syntax and not the general semantics). We'd end up with a pair like |
I broke the name/value separator part out into a child task |
Thank you for looking into this.
Since creating this issue, I looked at CLI guidelines of POSIX, GNU, Solaris and realized that handling of space in clap for optional option-arguments is not the Unix way: #3030 |
Excuse me, when will we support for the single hyphen feature? Is there any PR working on it? |
Work to be done for this:
When doing these, we need to balance
However, this is not a high priority for me but the 4.x issues are. |
Child Tasks:
Please complete the following tasks
Describe your use case
There are many CLIs that do not follow the Unix way of short vs. long options. While it might not be a good idea for new programs to have such an interface, it may be needed for compatibility.
Examples
1. Long option with a single hyphen-minus (
-
) instead of a double hyphen-minus (--
)The examples are probably too many to count, as this is very common. From the output of
find --help
:From the output of
gcc --help
:From the output of
ld --help
:From the output of
qemu-system-x86_64 --help
2. Long option with a single plus (
+
) instead of a double hyphen-minus (--
)I'm sure there are others, but I can point to the output of
Xwayland --help
for this:3. Short option with a plus (
+
) instead of a hyphen-minus (-
)In this case it is a short option because it can be combined as
+OO opt1 opt2
. Although the value needs to be separated with a space:+Oopt1
does not work. Fromman 1 bash
:4. No space between option and value
As in short options, but the option is not a single character, so combining is not possible. From
gcc --help
:(I guess it looks like
W
is the short option and the first valuea
/p
/l
signifies assembler, preprocessor, or linker. But combining such short options would not make sense.)5. Long option with value after equals (
=
), but without the double hyphen-minus (--
)From
dd --help
6. Windows way: slash (
/
) instead of double hyphen-minus (--
) and colon (:
) instead of equals (=
)Not very familiar with Windows command line parameters, but from examples it seems only long options, mostly single-letter, are used. They are still "long" options since there is no combining. Option values are separated by a space or a colon (
:
). Also,/?
is the equivalent of-h, --help
.Describe the solution you'd like
Instead of (or in addition to) specifying short vs. long, maybe we could specify:
"-"
,"--"
,"/"
,"+"
,""
"="
,":"
Alternatives, if applicable
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: