add support for dashed arg names and values in arg! macro #3699
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While migrating from clap2 to clap3 I ran into lack of support for dashed arg names and values in clap::arg! macro
meanwhile such definitions were supported but functions like arg_from_usage
Here are some examples of such problematic argument usage descriptions
(another problem I found is that arg! macro does not allow [flag] before any of -f or --flag but that is a different story)
so my proposed just repeats what is already done for longarg
makes it possible to wrap arg name and arg value in double quotes so that it is interpreted as literal rather than an ident
thus arg!([some_arg] "some arg") becomes possible this way arg!(["some-arg"] "some arg")
and arg!(<some_val> "some val") becomes possible this way arg!(<"some-val"> "some val")
P.S some tests provided