prt-auf: fail gracefully when 'path' finds no hits in the ports tree

This commit is contained in:
John McQuah 2022-08-25 10:32:01 -04:00
parent 437fd837f9
commit 058a8807af

View File

@ -51,7 +51,7 @@ if ($action =~ /^(diff|quickdiff|listlocked|depends|deptree|remove|install|updat
############## Branch based on the requested action #################
if ($action eq "path") { @results = find_port_by_name(@query,1,1,0);
if ($action eq "path") { @results = find_port_by_name($query[0],1,1,0);
} elsif ($action eq "search") { @results = find_port_by_name(@query,0,$osearch{path},1);
} elsif ($action eq "fsearch") { $hh = find_port_by_file(".footprint", @query);
} elsif ($action eq "dsearch") { @results = find_port_by_desc(@query);
@ -89,9 +89,8 @@ if (($action =~ /^(listinst|listorphans)/)
printf "$strf", $result;
}
} elsif ($action =~ /^(list|search|dsearch|path|dependent)/) {
exit 1 if ($#results < 0);
foreach my $result (@results) {
chomp $result; next if ($result =~ /^\s*$/);
next if ((! $result) or ($result =~ /^\s*$/));
$result =~ s/.*\/(.*)$/$1/ if (($action ne "path") and ($osearch{path}==0));
$result .= " $V_REPO{$result}" if (($osearch{verbose}==1) and ($action ne "path"));
$result .= " $V_REPO{$result}\n$DESC{$result}\n" if (($osearch{verbose}>1) and ($action ne "path"));