You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance error reporting to better guide the user to the underlying issue and to the corresponding documentation.
The (minimalized) issue triggering this request was me trying to set a argument as follows:
use clap::{App, Arg};
fn main() {
let args = App::new("prog")
.arg(Arg::with_name("flag").long("flag").short("ff"))
.get_matches_from(vec!["prog", "-ff"]);
println!("{:?}", args);
}
As you can see I foolishly tried to set .short("ff") which does not work since only the first non - character is used as the short argument.
While the docs are quite clear about it, the error message I got is much less useful in my opinion:
error: The argument '--flag' was provided more than once, but cannot be used multiple times
My original use case involved more arguments, custom parsing, structopt, etc. and the cause of this issue was very much not obvious to me.
Describe the solution you'd like
What I would have liked to happen would be a Error or panic! out of the .short method, even before matching of the actual arguments happens, indicating that the provided short-name is not allowed.
While the docs are clear regarding this issue I did not even know to look there, instead thinking my custom parsing or the order of arguments messed some things up.
Alternatives, if applicable
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Please complete the following tasks
Clap Version
2.33.3
Describe your use case
Enhance error reporting to better guide the user to the underlying issue and to the corresponding documentation.
The (minimalized) issue triggering this request was me trying to set a argument as follows:
As you can see I foolishly tried to set
.short("ff")
which does not work since only the first non-
character is used as the short argument.While the docs are quite clear about it, the error message I got is much less useful in my opinion:
My original use case involved more arguments, custom parsing, structopt, etc. and the cause of this issue was very much not obvious to me.
Describe the solution you'd like
What I would have liked to happen would be a Error or panic! out of the
.short
method, even before matching of the actual arguments happens, indicating that the provided short-name is not allowed.While the docs are clear regarding this issue I did not even know to look there, instead thinking my custom parsing or the order of arguments messed some things up.
Alternatives, if applicable
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: