summaryrefslogtreecommitdiffstats
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
commit1e81de2892c6a4816577bb9a6b0a27d051435ec0 (patch)
tree8013d726837afe51fb8ed3f782c0095c0a0320c1
parenta68b95754dba768e3bc09a8792f7577a43cef010 (diff)
checkpkgist: add sort option
-rwxr-xr-xcheckpkgist/checkpkgist.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/checkpkgist/checkpkgist.php b/checkpkgist/checkpkgist.php
index b864d4e..3488d47 100755
--- a/checkpkgist/checkpkgist.php
+++ b/checkpkgist/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) {