mirror of
https://github.com/clap-rs/clap
synced 2024-12-15 07:12:32 +00:00
Also include required arguments in conflict output
This commit is contained in:
parent
4372aa0fa6
commit
6602feb9e6
1 changed files with 12 additions and 2 deletions
|
@ -185,10 +185,20 @@ impl<'help, 'app, 'parser> Validator<'help, 'app, 'parser> {
|
||||||
};
|
};
|
||||||
let used: Vec<Id> = matcher
|
let used: Vec<Id> = matcher
|
||||||
.arg_names()
|
.arg_names()
|
||||||
|
.filter(|key| *key != latter)
|
||||||
.cloned()
|
.cloned()
|
||||||
.filter(|key| key != latter)
|
|
||||||
.collect();
|
.collect();
|
||||||
let usg = Usage::new(self.p).create_usage_with_title(&used);
|
let required: Vec<Id> = used
|
||||||
|
.iter()
|
||||||
|
.filter_map(|key| self.p.app.find(key))
|
||||||
|
.flat_map(|key_arg| key_arg.requires.iter().map(|item| &item.1))
|
||||||
|
.filter(|item| !used.contains(item))
|
||||||
|
.filter(|key| *key != latter)
|
||||||
|
.chain(used.iter())
|
||||||
|
.cloned()
|
||||||
|
.collect();
|
||||||
|
println!("{:?}", required);
|
||||||
|
let usg = Usage::new(self.p).create_usage_with_title(&required);
|
||||||
return Err(Error::argument_conflict(
|
return Err(Error::argument_conflict(
|
||||||
former_arg,
|
former_arg,
|
||||||
Some(latter_arg.to_string()),
|
Some(latter_arg.to_string()),
|
||||||
|
|
Loading…
Reference in a new issue