Hola,

Currently "pkg_info -Q" doesn't respect other flags and the way
pkg_info(1) reads, it implies that they will work with it.

This diff makes pkg_info function as expected when other flags are
passed when using -Q.

Cheers,
Aaron

Index: OpenBSD/PkgInfo.pm
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v
retrieving revision 1.44
diff -u -p -r1.44 PkgInfo.pm
--- OpenBSD/PkgInfo.pm  25 Jan 2017 14:10:46 -0000      1.44
+++ OpenBSD/PkgInfo.pm  29 Jul 2017 16:32:54 -0000
@@ -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;


-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE

Reply via email to