-
-
Notifications
You must be signed in to change notification settings - Fork 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
Positional arguments with TrailingVarArgs shouldn't split on delim #511
Comments
Thanks for taking the time to find all this! Since the If you set that to The other option is to make the default behavior, if |
I was able to work around this by explicitly calling I still think this is undesirable behavior for this case. Consider that the same thing manifests in the case where "--" is passed to delineate a separate set of arguments, as in this other failing unittest: |
What we could do is add some logic to check if either My only hesitation with doing that is, is there anyone who wants values to be delimited when either of those two conditions are met? I'd say |
I can't imagine what the use case would be for that behavior, but it's possible someone would want it, I guess? Personally I think the delimiter-splitting shouldn't apply to positional arguments at all, that's very unintuitive to me. Supporting |
I'm using
AppSettings::TrailingVarArg
for a binary that wraps compiler execution to pass the rest of the commandline arguments down to the compiler. I found that compiler arguments were unexpectedly being split on commas (like-Wl,-foo
=> ["-Wl", "-foo"]).I wrote a (failing) unit test for this, but haven't tried to actually fix it:
luser@ad9f8d8
parse_positional
callsadd_val_to_arg
:https://github.com/kbknapp/clap-rs/blob/c8c20a046e9c2ea187fe2f511d5e2326d154025b/src/app/macros.rs#L122
which checks
val_delim
:https://github.com/kbknapp/clap-rs/blob/1de71c00585043758608f096e256c03666513a16/src/app/parser.rs#L1119
...which defaults to ",":
https://github.com/kbknapp/clap-rs/blob/1de71c00585043758608f096e256c03666513a16/src/args/arg.rs#L98
The text was updated successfully, but these errors were encountered: