diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2023-03-18 16:23:39 -0700 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2023-03-18 16:23:39 -0700 |
commit | 4b0bbc0b263a150eb9a9b59f196914629be06a9b (patch) | |
tree | 619723cfa449f93149b766ee397f85ce2acef5f7 /plugins/aliases/cheatsheet.py | |
parent | db7efd2336e4dbe6abf321b00dbc11bc5afb1355 (diff) | |
parent | 72732a224e886933df6b64a49ec6f5e94c884612 (diff) | |
download | zsh-4b0bbc0b263a150eb9a9b59f196914629be06a9b.tar.gz zsh-4b0bbc0b263a150eb9a9b59f196914629be06a9b.tar.bz2 zsh-4b0bbc0b263a150eb9a9b59f196914629be06a9b.zip |
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'plugins/aliases/cheatsheet.py')
-rw-r--r-- | plugins/aliases/cheatsheet.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/aliases/cheatsheet.py b/plugins/aliases/cheatsheet.py index 3362a6ab6..f742fba9e 100644 --- a/plugins/aliases/cheatsheet.py +++ b/plugins/aliases/cheatsheet.py @@ -15,6 +15,7 @@ def parse(line): def cheatsheet(lines): exps = [ parse(line) for line in lines ] + exps.sort(key=lambda exp:exp[2]) cheatsheet = {'_default': []} for key, group in itertools.groupby(exps, lambda exp:exp[2]): group_list = [ item for item in group ] @@ -56,8 +57,8 @@ def pretty_print(cheatsheet, wfilter, group_list=None, groups_only=False): pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter) if __name__ == '__main__': - parser = argparse.ArgumentParser(description="Pretty print aliases.") - parser.add_argument('filter', nargs="*", help="search aliases matching string") + parser = argparse.ArgumentParser(description="Pretty print aliases.", prog="acs") + parser.add_argument('filter', nargs="*", metavar="<keyword>", help="search aliases matching keywords") parser.add_argument('-g', '--group', dest="group_list", action='append', help="only print aliases in given groups") parser.add_argument('--groups', dest='groups_only', action='store_true', help="only print alias groups") args = parser.parse_args() |