diff options
author | Remi Collet <fedora@famillecollet.com> | 2014-05-16 13:58:43 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2014-05-16 13:58:43 +0200 |
commit | a00e255dc3a3b49f9cccf1659ca6222f87789f22 (patch) | |
tree | eb872150164056b46667af30609227bcaac2d9a3 /checkpkgist.php | |
parent | 6e70422ee9024a7e3ece8648d5b303937ec542cf (diff) |
checkpkgist: add sort option
Diffstat (limited to 'checkpkgist.php')
-rwxr-xr-x | checkpkgist.php | 9 |
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) { |