Add '-l' which will match a certain status code.
Add the submitter as a contributor in the man page freebsd -> FreeBSD, while I'm poking around. PR: bin/15162 Submitted by: Dominic Mitchell <dom@palmerharvey.co.uk>
This commit is contained in:
parent
a30945450e
commit
47f97505ad
@ -33,6 +33,7 @@
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm pkg_version
|
.Nm pkg_version
|
||||||
.Op Fl cdhv
|
.Op Fl cdhv
|
||||||
|
.Op Fl l Ar limchar
|
||||||
.Op Ar index
|
.Op Ar index
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
@ -59,7 +60,7 @@ index file could not be determined. A common reason for this message
|
|||||||
is that there are multiple versions of a particular software package
|
is that there are multiple versions of a particular software package
|
||||||
installed, or that multiple versions are listed in the index file.
|
installed, or that multiple versions are listed in the index file.
|
||||||
Examples from the
|
Examples from the
|
||||||
.Fx 2.2.6
|
.Fx
|
||||||
ports collection are the Tcl toolkit or the
|
ports collection are the Tcl toolkit or the
|
||||||
.Tn EMACS
|
.Tn EMACS
|
||||||
editor.
|
editor.
|
||||||
@ -75,6 +76,15 @@ system.
|
|||||||
Enable debugging output.
|
Enable debugging output.
|
||||||
.It Fl h
|
.It Fl h
|
||||||
Print help message.
|
Print help message.
|
||||||
|
.It Fl l
|
||||||
|
Limit the output to those packages whose status flag matches
|
||||||
|
.Ar limchar .
|
||||||
|
You may specify more than one character to match in
|
||||||
|
.Ar limchar .
|
||||||
|
Note that because some of the status flag characters are also special
|
||||||
|
to the shell, it is best to quote
|
||||||
|
.Ar limchar
|
||||||
|
with single quotes.
|
||||||
.It Fl v
|
.It Fl v
|
||||||
Enable verbose output. Verbose output includes some English-text
|
Enable verbose output. Verbose output includes some English-text
|
||||||
interpretations of the version number comparisons, as well as the
|
interpretations of the version number comparisons, as well as the
|
||||||
@ -112,7 +122,7 @@ index file:
|
|||||||
The command below generates a report against
|
The command below generates a report against
|
||||||
the version numbers in the on-line ports collection:
|
the version numbers in the on-line ports collection:
|
||||||
.Pp
|
.Pp
|
||||||
.Dl % pkg_version ftp://ftp.freebsd.org/pub/FreeBSD/ports-current/INDEX
|
.Dl % pkg_version ftp://ftp.FreeBSD.org/pub/FreeBSD/ports-current/INDEX
|
||||||
.Pp
|
.Pp
|
||||||
The command below generates a file of commands to run to update the installed
|
The command below generates a file of commands to run to update the installed
|
||||||
files. It is
|
files. It is
|
||||||
@ -126,7 +136,8 @@ suggestions, and then cut-and-paste (or retype) the commands you want to run.
|
|||||||
.Sh AUTHOR
|
.Sh AUTHOR
|
||||||
.An Bruce A. Mah Aq bmah@ca.sandia.gov
|
.An Bruce A. Mah Aq bmah@ca.sandia.gov
|
||||||
.Sh CONTRIBUTORS
|
.Sh CONTRIBUTORS
|
||||||
.An Nik Clayton Aq nik@freebsd.org
|
.An Nik Clayton Aq nik@FreeBSD.org ,
|
||||||
|
.An Dominic Mitchell Aq dom@palmerharvey.co.uk
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
There should be a better way of dealing with packages that
|
There should be a better way of dealing with packages that
|
||||||
can have more than one installed version.
|
can have more than one installed version.
|
||||||
|
@ -47,6 +47,7 @@ $ShowCommandsFlag = 0;
|
|||||||
$DebugFlag = 0;
|
$DebugFlag = 0;
|
||||||
$VerboseFlag = 0;
|
$VerboseFlag = 0;
|
||||||
$CommentChar = "#";
|
$CommentChar = "#";
|
||||||
|
$LimitFlag = "";
|
||||||
|
|
||||||
#
|
#
|
||||||
# CompareVersions
|
# CompareVersions
|
||||||
@ -124,6 +125,7 @@ Usage: pkg_version [-c] [-d debug] [-h] [-v] [index]
|
|||||||
-c Show commands to update installed packages
|
-c Show commands to update installed packages
|
||||||
-d debug Debugging output (debug controls level of output)
|
-d debug Debugging output (debug controls level of output)
|
||||||
-h Help (this message)
|
-h Help (this message)
|
||||||
|
-l limchar Limit output
|
||||||
-v Verbose output
|
-v Verbose output
|
||||||
index URL or filename of index file
|
index URL or filename of index file
|
||||||
(Default is $IndexFile)
|
(Default is $IndexFile)
|
||||||
@ -133,7 +135,7 @@ EOF
|
|||||||
#
|
#
|
||||||
# Parse command-line arguments, deal with them
|
# Parse command-line arguments, deal with them
|
||||||
#
|
#
|
||||||
if (!getopts('cdhv') || ($opt_h)) {
|
if (!getopts('cdhl:v') || ($opt_h)) {
|
||||||
&PrintHelp();
|
&PrintHelp();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -143,6 +145,9 @@ if ($opt_c) {
|
|||||||
if ($opt_d) {
|
if ($opt_d) {
|
||||||
$DebugFlag = $opt_d;
|
$DebugFlag = $opt_d;
|
||||||
}
|
}
|
||||||
|
if ($opt_l) {
|
||||||
|
$LimitFlag = $opt_l;
|
||||||
|
}
|
||||||
if ($opt_v) {
|
if ($opt_v) {
|
||||||
$VerboseFlag = 1;
|
$VerboseFlag = 1;
|
||||||
}
|
}
|
||||||
@ -258,7 +263,11 @@ foreach $packageName (sort keys %currentPackages) {
|
|||||||
$Comment = "unknown in index";
|
$Comment = "unknown in index";
|
||||||
}
|
}
|
||||||
|
|
||||||
write;
|
if ($LimitFlag) {
|
||||||
|
write if $versionCode =~ m/[$LimitFlag]/o;
|
||||||
|
} else {
|
||||||
|
write;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user