1 |
commit: bb585671418fa51682a7e1dbfef5914e26261adf |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 1 12:30:13 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 1 12:30:13 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bb585671 |
7 |
|
8 |
epkginfo: Add 'reverse' display option for equery |
9 |
|
10 |
This adds a small convenience for displaying the ebuilds in reverse |
11 |
order. This helps people prune packages that grow quickly as the |
12 |
most relevant ones are at the top. |
13 |
|
14 |
pym/gentoolkit/equery/meta.py | 7 +++++-- |
15 |
1 file changed, 5 insertions(+), 2 deletions(-) |
16 |
|
17 |
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py |
18 |
index ea1c96a..e9f5cea 100644 |
19 |
--- a/pym/gentoolkit/equery/meta.py |
20 |
+++ b/pym/gentoolkit/equery/meta.py |
21 |
@@ -89,6 +89,7 @@ def print_help(with_description=True, with_usage=True): |
22 |
(" -k, --keywords", "show keywords for all matching package versions"), |
23 |
(" -l, --license", "show licenses for the best maching version"), |
24 |
(" -m, --maintainer", "show the maintainer(s) for the package"), |
25 |
+ (" -r, --reverse", "show the output in reverse order if applicable"), |
26 |
(" -S, --stablreq", "show STABLEREQ arches (cc's) for all matching package versions"), |
27 |
(" -u, --useflags", "show per-package USE flag descriptions"), |
28 |
(" -U, --upstream", "show package's upstream information"), |
29 |
@@ -525,9 +526,9 @@ def parse_module_options(module_opts): |
30 |
def main(input_args): |
31 |
"""Parse input and run the program.""" |
32 |
|
33 |
- short_opts = "hdHklmSuUx" |
34 |
+ short_opts = "hdHklmrSuUx" |
35 |
long_opts = ('help', 'description', 'herd', 'keywords', 'license', |
36 |
- 'maintainer', 'stablereq', 'useflags', 'upstream', 'xml') |
37 |
+ 'maintainer', 'reverse', 'stablereq', 'useflags', 'upstream', 'xml') |
38 |
|
39 |
try: |
40 |
module_opts, queries = gnu_getopt(input_args, short_opts, long_opts) |
41 |
@@ -561,6 +562,8 @@ def main(input_args): |
42 |
print() |
43 |
|
44 |
matches.sort() |
45 |
+ matches.sort(reverse=any(name in ('-r', '--reverse') |
46 |
+ for name, opt in module_opts)) |
47 |
call_format_functions(best_match, matches) |
48 |
|
49 |
first_run = False |