Open epage opened 2 years ago
Comment by FrankC01 Saturday Dec 04, 2021 at 11:45 GMT
This works if I change
.requires_ifs(&[("output", "excel"), ("output", "csv")])
to
.required_ifs(&[("output", "excel"), ("output", "csv")])
Comment by epage Saturday Dec 04, 2021 at 17:53 GMT
Yes
filename
cannot be present unless X conditions are met (prog -f file
will fail without -o excel
)filename
must be present if X conditions are met (prog -o excel
will fail without -f file
)Comment by epage Saturday Dec 04, 2021 at 17:54 GMT
And I do feel like we could do a better job clarifying that distinction
Comment by FrankC01 Sunday Dec 05, 2021 at 09:09 GMT
However, while required_ifs
fails if -f <arg>
is not supplied with -o <arg>
, it does not fail if I do prog -f somefile
Basically I'm looking for a way to:
-f <arg>
appears without -o <arg
then fail-o <arg>
appears without -f <arg>
then failAm I missing some magic combo?
Issue by FrankC01 Saturday Dec 04, 2021 at 11:16 GMT Originally opened as https://github.com/clap-rs/clap/issues/3059
Please complete the following tasks
Rust Version
rustc 1.55.0 (c8dfcfe04 2021-09-06)
Clap Version
clap = "2.33.3"
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo test
Actual Behaviour
No error occurred
Expected Behaviour
Expected error as the
-f <val>
is required if-o excel
or-o csv
is presentAdditional Context
No response
Debug Output
No response