Implement the 'Q' option which is like 'q' (quiet output) except

that it prefaces the output with the package name.

This is useful for things like this:

# pkg_info -Qsa | awk -F : '{print $2 "\t" $1}' | sort -rn | expand -t 10
This commit is contained in:
Matthew N. Dodd 2003-03-25 00:51:41 +00:00
parent b5cff0d653
commit 5e3714183f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112572
4 changed files with 17 additions and 2 deletions

View File

@ -61,6 +61,7 @@ TAILQ_HEAD(which_head, which_entry);
extern int Flags;
extern Boolean Quiet;
extern Boolean QUIET;
extern char *InfoPrefix;
extern char PlayPen[];
extern char *CheckPkg;

View File

@ -26,11 +26,12 @@ __FBSDID("$FreeBSD$");
#include "info.h"
#include <err.h>
static char Options[] = "acdDe:fgGhiIkl:LmoO:pPqrRst:vVW:x";
static char Options[] = "acdDe:fgGhiIkl:LmoO:pPqQrRst:vVW:x";
int Flags = 0;
match_t MatchType = MATCH_GLOB;
Boolean Quiet = FALSE;
Boolean QUIET = FALSE;
char *InfoPrefix = (char *)(uintptr_t)"";
char PlayPen[FILENAME_MAX];
char *CheckPkg = NULL;
@ -151,6 +152,11 @@ main(int argc, char **argv)
Quiet = TRUE;
break;
case 'Q':
Quiet = TRUE;
QUIET = TRUE;
break;
case 't':
strlcpy(PlayPen, optarg, sizeof(PlayPen));
break;

View File

@ -191,6 +191,8 @@ pkg_do(char *pkg)
/* Start showing the package contents */
if (!Quiet)
printf("%sInformation for %s:\n\n", InfoPrefix, pkg);
else if (QUIET)
printf("%s%s:", InfoPrefix, pkg);
if (Flags & SHOW_COMMENT)
show_file("Comment:\n", COMMENT_FNAME);
if (Flags & SHOW_REQUIRE)

View File

@ -25,16 +25,18 @@
.Nd a utility for displaying information on software packages
.Sh SYNOPSIS
.Nm
.Op Fl cdDfgGiIkLmopPqrRsvVx
.Op Fl cdDfgGiIkLmopPqQrRsvVx
.Op Fl e Ar package
.Op Fl l Ar prefix
.Op Fl t Ar template
.Op Ar pkg-name ...
.Nm
.Op Fl q
.Op Fl Q
.Fl W Ar filename
.Nm
.Op Fl q
.Op Fl Q
.Fl O Ar origin
.Nm
.Fl a
@ -67,6 +69,10 @@ Be
.Dq quiet
in emitting report headers and such, just dump the
raw info (basically, assume a non-human reading).
.It Fl Q
Be
.Dq quiet
as above but print preface output with the package name.
.It Fl c
Show the (one line) comment field for each package.
.It Fl d