Skip to content

Commit

Permalink
fix(usage): groups unfold their members in usage strings
Browse files Browse the repository at this point in the history
Closes #114
  • Loading branch information
kbknapp committed May 10, 2015
1 parent fd53cd1 commit 55d1558
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,18 +734,16 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
}
}

if g_vec.is_empty() {
args.dedup();
return args.iter().map(ToOwned::to_owned).collect()
}
g_vec.dedup();
return g_vec.iter()
.map(|g| self.get_group_members(g))
.fold(vec![], |mut acc, v| {
v.into_iter().map(|i| acc.push(i)).collect::<Vec<_>>();
acc
})

if !g_vec.is_empty() {
for av in g_vec.iter().map(|g| self.get_group_members(g)) {
for a in av {
args.push(a);
}
}
}
args.dedup();
args.iter().map(ToOwned::to_owned).collect()
}

fn get_group_members_names(&self, group: &'ar str) -> Vec<&'ar str> {
Expand All @@ -767,16 +765,15 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
}

g_vec.dedup();
if g_vec.is_empty() {
args.dedup();
return args.iter().map(|s| *s).collect()
}
return g_vec.iter()
.map(|g| self.get_group_members_names(g))
.fold(vec![], |mut acc, v| {
v.into_iter().map(|i| acc.push(i)).collect::<Vec<_>>();
acc
})
if !g_vec.is_empty() {
for av in g_vec.iter().map(|g| self.get_group_members_names(g)) {
for a in av {
args.push(a);
}
}
}
args.dedup();
args.iter().map(|s| *s).collect()
}

fn get_required_from(&self, mut reqs: Vec<&'ar str>) -> VecDeque<String> {
Expand Down

0 comments on commit 55d1558

Please sign in to comment.