From bb585671418fa51682a7e1dbfef5914e26261adf Mon Sep 17 00:00:00 2001 From: Mike Pagano Date: Tue, 1 May 2018 08:30:13 -0400 Subject: epkginfo: Add 'reverse' display option for equery This adds a small convenience for displaying the ebuilds in reverse order. This helps people prune packages that grow quickly as the most relevant ones are at the top. --- pym/gentoolkit/equery/meta.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py index ea1c96a..e9f5cea 100644 --- a/pym/gentoolkit/equery/meta.py +++ b/pym/gentoolkit/equery/meta.py @@ -89,6 +89,7 @@ def print_help(with_description=True, with_usage=True): (" -k, --keywords", "show keywords for all matching package versions"), (" -l, --license", "show licenses for the best maching version"), (" -m, --maintainer", "show the maintainer(s) for the package"), + (" -r, --reverse", "show the output in reverse order if applicable"), (" -S, --stablreq", "show STABLEREQ arches (cc's) for all matching package versions"), (" -u, --useflags", "show per-package USE flag descriptions"), (" -U, --upstream", "show package's upstream information"), @@ -525,9 +526,9 @@ def parse_module_options(module_opts): def main(input_args): """Parse input and run the program.""" - short_opts = "hdHklmSuUx" + short_opts = "hdHklmrSuUx" long_opts = ('help', 'description', 'herd', 'keywords', 'license', - 'maintainer', 'stablereq', 'useflags', 'upstream', 'xml') + 'maintainer', 'reverse', 'stablereq', 'useflags', 'upstream', 'xml') try: module_opts, queries = gnu_getopt(input_args, short_opts, long_opts) @@ -561,6 +562,8 @@ def main(input_args): print() matches.sort() + matches.sort(reverse=any(name in ('-r', '--reverse') + for name, opt in module_opts)) call_format_functions(best_match, matches) first_run = False -- cgit v1.2.3-65-gdbad