Some extra debugging

This commit is contained in:
CreepySkeleton 2020-04-21 14:17:18 +03:00
parent 0a3921f554
commit 66f85d07a0
2 changed files with 9 additions and 3 deletions

View file

@ -1975,22 +1975,26 @@ impl<'b> App<'b> {
}
pub(crate) fn unroll_args_in_group(&self, group: &Id) -> Vec<Id> {
debugln!("App::unroll_args_in_group: group={:?}", group);
let mut g_vec = vec![group];
let mut args = vec![];
while let Some(ref g) = g_vec.pop() {
while let Some(g) = g_vec.pop() {
for n in self
.groups
.iter()
.find(|grp| grp.id == **g)
.find(|grp| grp.id == *g)
.expect(INTERNAL_ERROR_MSG)
.args
.iter()
{
debugln!("App::unroll_args_in_group:iter: entity={:?}", n);
if !args.contains(n) {
if self.find(n).is_some() {
debugln!("App::unroll_args_in_group:iter: this is an arg");
args.push(n.clone())
} else {
debugln!("App::unroll_args_in_group:iter: this is a group");
g_vec.push(n);
}
}

View file

@ -307,7 +307,7 @@ impl<'b, 'c, 'z> Validator<'b, 'c, 'z> {
// args in that group to the conflicts, as well as any args those args conflict
// with
// // FIXME: probably no need to cone the id here. Review the macro
// // FIXME: probably no need to clone the id here. Review the macro
for grp in groups_for_arg!(self.p.app, name.clone()) {
if let Some(g) = self
.p
@ -508,10 +508,12 @@ impl<'b, 'c, 'z> Validator<'b, 'c, 'z> {
for arg_or_group in self.p.required.iter().filter(|r| !matcher.contains(r)) {
debugln!("Validator::validate_required:iter:aog={:?};", arg_or_group);
if let Some(arg) = self.p.app.find(&arg_or_group) {
debugln!("Validator::validate_required:iter: This is an arg");
if !self.is_missing_required_ok(arg, matcher) {
return self.missing_required_error(matcher, None);
}
} else if let Some(group) = self.p.app.groups.iter().find(|g| g.id == *arg_or_group) {
debugln!("Validator::validate_required:iter: This is a group");
if !self
.p
.app