prt-auf: fix bugs in the arg parser

This commit is contained in:
John McQuah 2023-03-19 18:52:28 -04:00
parent f90978bcd8
commit 9682dcde14

View File

@ -66,7 +66,7 @@ if ($action eq "path") { @results = find_port_by_name($query[0],1,1,0);
} elsif ($action eq "unlock") { port_unlock(@query);
} elsif ($action eq "ls") { port_ls(@query);
} elsif ($action =~ /^(cat|edit|readme)$/) { port_edit($1,@query);
} elsif ($action =~ /^(depends|quick)dep$/) { @results=deporder($1,@query);
} elsif ($action =~ /^(depends|quickdep)$/) { @results=deporder($1,@query);
} elsif ($action =~ /^dep(endent|tree)$/) { @results=list_ports($action,@query);
} elsif ($action eq "sysup") { my @outdated = grep { s/ .+// } port_diff("quick");
@results = up_inst("sysup", @outdated);
@ -572,7 +572,7 @@ sub list_ports {
our $indent=" "; our $height=0;
our $ind; our %seen; our @lineage; my @fosters=();
$ind = ($V_INST{$seed}) ? "[i]" : "[ ]";
print "$ind $seed\n" if (($odepends{tree}==1) or ($odepends{all}==1));
print "$ind $seed\n" if ($odepends{tree}==1);
$seen{$seed} = 1;
my @children = ($direction eq "fwd") ? split /[ ,]/, $DEPENDS{$sseed}:
grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace;
@ -615,6 +615,7 @@ sub list_ports {
$height = $#lineage+1;
}
}
delete $seen{$seed} if ($odepends{tree} == 0);
@found = sort(keys %seen);
}
# possibilities for the recursive switch have been exhausted
@ -656,8 +657,8 @@ sub deporder {
# returns an annotated list using a variation on depth-first search.
# Recursion does NOT continue beyond a dependency satisfied by an alias.
our @treewalk=(); our %seen; our @missing; my @seeds=@_; our @results;
our %imark; our %fmark; our $fmarks; my $type=shift;
my $type=shift; my @seeds=@_; our @treewalk=(); our %seen; our @missing;
our %imark; our %fmark; our $fmarks; our @results;
# first strip out all the names not found in the ports collections
push @missing, grep { (! $V_REPO{$_}) } @seeds;
@ -725,7 +726,7 @@ sub deporder {
$fmarks = keys %fmark;
push (@results, $node);
}
if (($#missing>-1) and ($type ne "quick")) { push (@results, "MISSING", @missing); }
if (($#missing>-1) and ($type ne "quickdep")) { push (@results, "MISSING", @missing); }
return @results;
}