Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Neidhardt <ambrevar@gmail.com>2014-02-09 19:41:42 +0100
committerAllan McRae <allan@archlinux.org>2014-03-03 11:25:55 +1000
commit894773eb5bb054ba9750d9be269814c7e6672766 (patch)
tree25ae0365c4d9c06988d816b414425eb1f9af3b28
parente2fe0525765504b99178abbe94524ee8768c4d9d (diff)
pacsearch: fields are treated uniformly when printing
We include the leading space in the match for 'group' and 'installed'. This allows us to remove the conditions when printing. Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--contrib/pacsearch.in20
1 files changed, 10 insertions, 10 deletions
diff --git a/contrib/pacsearch.in b/contrib/pacsearch.in
index 91cf3645..0ab840e1 100644
--- a/contrib/pacsearch.in
+++ b/contrib/pacsearch.in
@@ -91,11 +91,8 @@ sub print_pkg {
} else {
print "$MAGENTA";
}
- print "$v[0]/$RESET$BOLD$v[1] $GREEN$v[2]";
- print " $BLUE$v[3]" if $v[3] ne "";
- print " $CYAN$v[4]" if $v[4] ne "";
- print " $RESET\n";
- print " $v[5]\n";
+ print "$v[0]/$RESET$BOLD$v[1] $GREEN$v[2]$BLUE$v[3]$CYAN$v[4]$RESET\n";
+ print "$v[5]\n";
}
my %allpkgs = ();
@@ -110,8 +107,10 @@ if ($#syncpkgs >= 0) {
}
foreach $_ (@syncpkgs) {
- # we grab the following fields: repo, name, ver, group, installed, and desc
- my @pkgfields = /^(.*?)\/(.*?) (.*?) ?(\(.*?\))? ?(\[.*\])?\n(.*)$/s;
+ # We grab the following fields: repo, name, ver, group, installed, and
+ # desc. We grab leading space for 'group' and 'installed' so that we do not
+ # need to test if non-empty when printing.
+ my @pkgfields = /^(.*?)\/(.*?) (.*?)( \(.*?\))?( \[.*\])?\n(.*)$/s;
if(not @pkgfields) {
# skip any non-matching line and just print it for the user
print $_, "\n";
@@ -135,15 +134,16 @@ if ($#querypkgs >= 0) {
}
foreach $_ (@querypkgs) {
- # we grab the following fields: repo, name, ver, group, installed, and desc
- my @pkgfields = /^(.*?)\/(.*?) (.*?) ?(\(.*?\))? ?(\[.*\])?\n(.*)$/s;
+ # We grab the same field as before, even the "installed" which is always
+ # empty for local searches. This allows us to reserve a cell in @pkgfields.
+ my @pkgfields = /^(.*?)\/(.*?) (.*?)( \(.*?\))?( \[.*\])?\n(.*)$/s;
# skip any non-matching line
next if not defined $pkgfields[1];
# check if the package was listed in the sync out
if (not exists $allpkgs{$pkgfields[1] . $pkgfields[2]}) {
# since 'group' is optional, we should fill it in if necessary
$pkgfields[3] = "" if not defined $pkgfields[3];
- $pkgfields[4] = "[$LC_INSTALLED]";
+ $pkgfields[4] = " [$LC_INSTALLED]";
push (@pkglist, \@pkgfields);
}
}