summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bieber <abieber@cvs.openbsd.org>2017-08-03 13:08:59 +0000
committerAaron Bieber <abieber@cvs.openbsd.org>2017-08-03 13:08:59 +0000
commite321b9f375b1252bb208ad3b80c2b422171f845f (patch)
treec972c966f06712308ce3d539e120ac27757ffbb5
parent40a37d5da2120ffb3c4d0cedac5f81aaaf35e94d (diff)
Make -Q work play nice with other flags. This makes things like:
"pkg_info -Q quake -d" function as expected. OK landry@
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgInfo.pm27
1 files changed, 17 insertions, 10 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
index 86caaa83667..da2ffce9d56 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgInfo.pm,v 1.44 2017/01/25 14:10:46 espie Exp $
+# $OpenBSD: PkgInfo.pm,v 1.45 2017/08/03 13:08:58 abieber Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -406,13 +406,18 @@ sub print_info
}
$state->say("#1", $compose);
} elsif ($state->opt('I')) {
- if ($state->opt('q')) {
- $state->say("#1", $pkg);
+ if ($state->opt('Q')) {
+ $state->say(
+ is_installed($pkg) ? "#1 (installed)" : "#1", $pkg);
} else {
- my $l = 20 - length($pkg);
- $l = 1 if $l <= 0;
- $state->say("#1#2#3", $pkg, " "x$l,
- get_comment($handle->info));
+ if ($state->opt('q')) {
+ $state->say("#1", $pkg);
+ } else {
+ my $l = 20 - length($pkg);
+ $l = 1 if $l <= 0;
+ $state->say("#1#2#3", $pkg, " "x$l,
+ get_comment($handle->info));
+ }
}
} else {
if ($state->opt('c')) {
@@ -468,7 +473,7 @@ sub print_info
OpenBSD::x509::print_certificate_info($plist);
} elsif ($sig->{key} eq 'signify' ||
$sig->{key} eq 'signify2') {
- $state->say("reportedly signed by #1",
+ $state->say("reportedly signed by #1",
$plist->get('signer')->name);
}
} else {
@@ -601,8 +606,10 @@ sub parse_and_run
my $r = $state->repo->match_locations($partial);
for my $p (sort map {$_->name} @$r) {
- $state->say(
- is_installed($p) ? "#1 (installed)" : "#1", $p);
+ $self->find_pkg($state, $p,
+ sub {
+ $self->print_info($state, @_);
+ });
}
return 0;