mirror of
https://github.com/clap-rs/clap
synced 2024-09-21 06:41:54 +00:00
fix(args): fix bug in arguments who are required and mutually exclusive
When arguments are required-by-default and also mutually exclusive with other arguments and the user chooses the mutually eclusive argument, the requirements must be updated as well.
This commit is contained in:
parent
918f52ea35
commit
6ceb88a594
1 changed files with 5 additions and 0 deletions
|
@ -800,6 +800,7 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
|
|||
if let Some(ref bl) = p.blacklist {
|
||||
for name in bl {
|
||||
self.blacklist.insert(name);
|
||||
self.required.remove(name);
|
||||
}
|
||||
}
|
||||
if self.required.contains(p.name) {
|
||||
|
@ -948,6 +949,7 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
|
|||
if let Some(ref bl) = v.blacklist {
|
||||
for name in bl {
|
||||
self.blacklist.insert(name);
|
||||
self.required.remove(name);
|
||||
}
|
||||
}
|
||||
if self.required.contains(v.name) {
|
||||
|
@ -1005,6 +1007,7 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
|
|||
if let Some(ref bl) = v.blacklist {
|
||||
for name in bl {
|
||||
self.blacklist.insert(name);
|
||||
self.required.remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1070,6 +1073,7 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
|
|||
if let Some(ref bl) = v.blacklist {
|
||||
for name in bl {
|
||||
self.blacklist.insert(name);
|
||||
self.required.remove(name);
|
||||
}
|
||||
}
|
||||
if self.required.contains(v.name) {
|
||||
|
@ -1130,6 +1134,7 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
|
|||
if let Some(ref bl) = v.blacklist {
|
||||
for name in bl {
|
||||
self.blacklist.insert(name);
|
||||
self.required.remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue