-
-
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 for single hyphen in long arguments #1210
Comments
We had an issue open for this and it's...disappeared? Thanks for (re)submitting! We'll need to go about the design of this a little bit because there were some open questions in the last discussion about this feature. First and foremost, this will be an opt-in feature, probably via an Now, once someone has opted-in, should Should they be allowed with How should they interact with the current stacking of shorts? (i.e. right now if a CLI defines three shorts Once we get good answers on these questions we can start the implementation. |
@kbknapp Hi! Yes that is strange that it disappeared! In my particular use case, it would be fine for single hyphen |
@kbknapp I would also be happy to help out with the implementation if it's not considered too complex for someone new to the project |
@kellpossible I think this one will be a rather complex implementation, so I'd rather wait until 3.x where the internals are a little more clean and easy to work with. I'm also good with it disabling double hyphen longs and stacking, although I'm ok with shorts still sticking around. |
This could also play into my wanting to support Windows style CLIs where |
One way of achieving this would be to have "styles" for long and short versions, where this use case could use two styles "double hyphen" and "single hyphen" so that it is clear that |
Is there any update on this one? I need to have some kind of single hyphen "multi-char arguments" in order to comply to a given argument specification: https://developer.elgato.com/documentation/stream-deck/sdk/registration-procedure/#compiled-plugin-registration These specifications require my application to accept single hypen arguments like Would love to just be able to use Maybe even when not having this supported (yet), maybe some additional note on the long-argument stuff would help to reduce searching this (and getting frustrated by that). |
As far as I'm aware, there was no work on this during 3.0's development and we are at this point prioritizing polish to get the the release out. kbnapp previously said 3.0's code base should help. I wonder if #2915, with keeping this in mind, could make it even easier by offering lexing strategies. If we use a trait for this, then we could easily extend to any lexing style. This would be a big help for keeping the parser code understandable since it wouldn't need special cases for style and whether shorts are supported or not. While not required, something also for us to consider is how to keep code size down with this. Any kind of flag-based runtime control will mean only a really powerful link-time optimizer would cut out the extra code. If we were okay with taking the lexing trait into the public API of clap, directly or indirectly, and if its object safe, we could accept a |
See #2468 for a collection of non-Unix examples that include:
|
Yeah, going to go ahead and close this out in favor of #2468 |
Maintainer's notes:
Hi, I would like to begin porting a piece of command line software to rust which uses arguments of the style "-argument" with a single hyphen instead of the usual "--argument" with two hyphens preceding the name of the argument, I would like to use clap for parsing these arguments, but it sounds like clap does not yet support this functionality?
The text was updated successfully, but these errors were encountered: