Skip to content

Commit

Permalink
fix(Groups): fixes some usage strings that contain both args in group…
Browse files Browse the repository at this point in the history
…s and ones that conflict with each other

Args that conflict *and* are in a group will now only display in the
group and not in the usage string itself.

Closes #616
  • Loading branch information
kbknapp committed Aug 28, 2016
1 parent e28cc35 commit 3d782de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,17 @@ impl<'a, 'b> Parser<'a, 'b>
ret_val.push_back(s);
}
macro_rules! write_arg {
($i:expr, $m:ident, $v:ident, $r:ident) => {
($i:expr, $m:ident, $v:ident, $r:ident, $aig:ident) => {
for f in $v.into_iter() {
if $m.is_some() && $m.as_ref().unwrap().contains(f) {
if $m.is_some() && $m.as_ref().unwrap().contains(f) || $aig.contains(&f) {
continue;
}
$r.push_back($i.filter(|flg| &flg.name == &f).next().unwrap().to_string());
}
}
}
write_arg!(self.flags.iter(), matcher, c_flags, ret_val);
write_arg!(self.opts.iter(), matcher, c_opt, ret_val);
write_arg!(self.flags.iter(), matcher, c_flags, ret_val, args_in_groups);
write_arg!(self.opts.iter(), matcher, c_opt, ret_val, args_in_groups);
let mut g_vec = vec![];
for g in grps.into_iter() {
let g_string = self.args_in_group(g)
Expand Down

0 comments on commit 3d782de

Please sign in to comment.