mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 06:12:40 +00:00
v0.0.4.3
This commit is contained in:
parent
5a2cbb46c1
commit
59d78cc9bd
1 changed files with 17 additions and 4 deletions
21
src/app.rs
21
src/app.rs
|
@ -129,14 +129,16 @@ impl App {
|
|||
for f in self.flags.iter() {
|
||||
if let Some(l) = f.long {
|
||||
if l == p_arg {
|
||||
found = true;
|
||||
let mut mult = false;
|
||||
for ff in matches.flags.iter_mut() {
|
||||
if ff.name == f.name {
|
||||
// already in matches
|
||||
ff.occurrences = if ff.multiple { ff.occurrences + 1 } else { 1 };
|
||||
found = true;
|
||||
mult = true;
|
||||
}
|
||||
}
|
||||
if ! found {
|
||||
if ! mult {
|
||||
matches.flags.push(f.clone())
|
||||
}
|
||||
return "";
|
||||
|
@ -191,9 +193,20 @@ impl App {
|
|||
}
|
||||
for f in self.flags.iter() {
|
||||
if let Some(s) = f.short {
|
||||
if c == s {
|
||||
if s == c {
|
||||
found = true;
|
||||
matches.flags.push(f.clone());
|
||||
let mut mult = false;
|
||||
for ff in matches.flags.iter_mut() {
|
||||
if ff.name == f.name {
|
||||
// already in matches
|
||||
ff.occurrences = if ff.multiple { ff.occurrences + 1 } else { 1 };
|
||||
mult = true;
|
||||
}
|
||||
}
|
||||
if ! mult {
|
||||
matches.flags.push(f.clone())
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue