mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
feat: implements posix compatible conflicts for long args
This commit is contained in:
parent
70e48d1357
commit
8c2d48acf5
1 changed files with 22 additions and 0 deletions
22
src/app.rs
22
src/app.rs
|
@ -2570,6 +2570,17 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
|||
true,
|
||||
Some(matches.args.keys().map(|k| *k).collect()));
|
||||
}
|
||||
self.overrides.dedup();
|
||||
debugln!("checking if {} is in overrides", v.name);
|
||||
if self.overrides.contains(&v.name) {
|
||||
debugln!("it is...");
|
||||
debugln!("checking who defined it...");
|
||||
if let Some(name) = self.overriden_from(v.name, matches) {
|
||||
debugln!("found {}", name);
|
||||
matches.args.remove(name);
|
||||
remove_override!(self, name);
|
||||
}
|
||||
}
|
||||
if let Some(ref or) = v.overrides {
|
||||
for pa in or {
|
||||
matches.args.remove(pa);
|
||||
|
@ -2691,6 +2702,17 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
|||
true,
|
||||
Some(matches.args.keys().map(|k| *k).collect()));
|
||||
}
|
||||
self.overrides.dedup();
|
||||
debugln!("checking if {} is in overrides", v.name);
|
||||
if self.overrides.contains(&v.name) {
|
||||
debugln!("it is...");
|
||||
debugln!("checking who defined it...");
|
||||
if let Some(name) = self.overriden_from(v.name, matches) {
|
||||
debugln!("found {}", name);
|
||||
matches.args.remove(name);
|
||||
remove_override!(self, name);
|
||||
}
|
||||
}
|
||||
if let Some(ref or) = v.overrides {
|
||||
for pa in or {
|
||||
matches.args.remove(pa);
|
||||
|
|
Loading…
Reference in a new issue