summaryrefslogtreecommitdiffstats
path: root/checkpkgist.php
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-05-16 13:58:43 +0200
committerRemi Collet <fedora@famillecollet.com>2014-05-16 13:58:43 +0200
commita00e255dc3a3b49f9cccf1659ca6222f87789f22 (patch)
treeeb872150164056b46667af30609227bcaac2d9a3 /checkpkgist.php
parent6e70422ee9024a7e3ece8648d5b303937ec542cf (diff)
checkpkgist: add sort option
Diffstat (limited to 'checkpkgist.php')
-rwxr-xr-xcheckpkgist.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/checkpkgist.php b/checkpkgist.php
index b864d4e..3488d47 100755
--- a/checkpkgist.php
+++ b/checkpkgist.php
@@ -68,7 +68,7 @@ if (in_array('-h', $_SERVER['argv']) || in_array('--help', $_SERVER['argv'])) {
usage checkpkg [ options ]
-h
- --help Display help (this page)
+ --help Display help (this page)
-v
--verbose Display all packages, with upsteam information
@@ -76,10 +76,14 @@ usage checkpkg [ options ]
-q
--quiet Don't display not installed packages
or packages with latest version installed
+
+ -s
+ --sort Sort output by package name
END;
die("\n\n");
}
+$sort = (in_array('-s', $_SERVER['argv']) || in_array('--sort', $_SERVER['argv']));
$verb = (in_array('-v', $_SERVER['argv']) || in_array('--verbose', $_SERVER['argv']));
$quiet = (in_array('-q', $_SERVER['argv']) || in_array('--quiet', $_SERVER['argv']));
$client = new PkgClient();
@@ -93,6 +97,9 @@ if (!$pkgs) {
die("Bad configuration file\n");
}
+if ($sort) {
+ natcasesort($pkgs);
+}
printf(" %-40s %15s %15s %15s\n", "Name", "Version", "Upstream", "Date");
foreach ($pkgs as $name => $rpm) {