mirror of
https://github.com/clap-rs/clap
synced 2024-11-13 08:07:11 +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,
|
true,
|
||||||
Some(matches.args.keys().map(|k| *k).collect()));
|
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 {
|
if let Some(ref or) = v.overrides {
|
||||||
for pa in or {
|
for pa in or {
|
||||||
matches.args.remove(pa);
|
matches.args.remove(pa);
|
||||||
|
@ -2691,6 +2702,17 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
||||||
true,
|
true,
|
||||||
Some(matches.args.keys().map(|k| *k).collect()));
|
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 {
|
if let Some(ref or) = v.overrides {
|
||||||
for pa in or {
|
for pa in or {
|
||||||
matches.args.remove(pa);
|
matches.args.remove(pa);
|
||||||
|
|
Loading…
Reference in a new issue