-
-
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
Multiple value doesn't work when the first argument attached to short flag #3903
Comments
+1. Migrated from structopt 0.3.26. When attempting to parse a #[clap(arg_required_else_help = true)]
Add {
#[clap(value_parser)]
job: String,
#[clap(short = 'f', long = "files", value_parser)]
file_path: Vec<String>,
} $ cargo run add -f "test" "test1" "test2"
error: Found argument 'test2' which wasn't expected, or isn't valid in this context
USAGE:
kip add --files <FILE_PATH> <JOB>
For more information try --help This functionality worked prior in structopt so I'm assuming this may be a side effect of the v3 upgrade. Versions:
|
@ciehanski your case is slightly different. See #3213 |
While I don't know the original intent of the change between 2 and 3, I would say this is expected behavior. My way of thinking of this is to look at the I'd be willing to hear other thoughts on this and we can dig into the history. I'll leave this open for now for that conversation but I'm assuming this will be closed as expected. |
I found |
@key262yek In CPython,
should have the same behavior as…
(here, the I hope that helps. |
@fanninpm I understand your two examples are equivalent. |
@key262yek Perhaps what is needed in this case is the |
Please complete the following tasks
Rust Version
rustc 1.62.0 (a8314ef7d 2022-06-27)
Clap Version
3.2.8
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo run
Actual Behaviour
error: Found argument 'b' which wasn't expected, or isn't valid in this context
Expected Behaviour
program ends without error
Additional Context
In clap v2.34, following equivalent code works fine.
I want to ask, this result is whether a bug or what you expected
Debug Output
error: Found argument 'b' which wasn't expected, or isn't valid in this context
The text was updated successfully, but these errors were encountered: