use clap::Clap;
mod args;
fn main() {
let args = args::Args::parse();
println!("{:?}", args);
}
if I call the executable like this (passing an invalid flag):
./target/debug/teste -d
it returns this message:
error: Found argument '-d' which wasn't expected, or isn't valid in this context
If you tried to supply `-d` as a value rather than a flag, use `-- -d`
USAGE:
teste [FLAGS]
For more information try --help
Describe the solution you'd like
It would be nice any global configuration in Clap to avoid suggestions like -- -x. The message would be like this, which is much clear for the user (since the application contains only two optional flags):
error: Found argument '-d' which wasn't expected, or isn't valid in this context
USAGE:
teste [FLAGS]
For more information try --help
or:
error: Found argument '-d' which wasn't expected, or isn't valid
USAGE:
teste [FLAGS]
For more information try --help
or even:
error: Found argument '-d' which isn't valid
USAGE:
teste [FLAGS]
For more information try --help
Issue by silvioprog Thursday Sep 09, 2021 at 18:54 GMT Originally opened as https://github.com/clap-rs/clap/issues/2766
Please complete the following tasks
Clap Version
3.0.0-beta.4
Describe your use case
Hi.
Assuming I have an
args.rs
file:and a
main.rs
:if I call the executable like this (passing an invalid flag):
it returns this message:
Describe the solution you'd like
It would be nice any global configuration in Clap to avoid suggestions like
-- -x
. The message would be like this, which is much clear for the user (since the application contains only two optional flags):or:
or even:
Alternatives, if applicable
No response
Additional Context
No response