From 1a944f574eef7b8df92b42cf4deada53360832c8 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 15 May 2021 18:20:59 -0700 Subject: [PATCH] Add command tag-list. --- frontends/etiquette_cli.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/frontends/etiquette_cli.py b/frontends/etiquette_cli.py index 7a62cc2..116269c 100644 --- a/frontends/etiquette_cli.py +++ b/frontends/etiquette_cli.py @@ -454,6 +454,17 @@ def tag_breplace_argparse(args): tag.add_synonym(tag_name) photodb.commit() +def tag_list_argparse(args): + photodb = find_photodb() + tags = photodb.get_all_tag_names() + synonyms = photodb.get_all_synonyms() + keys = sorted(tags.union(synonyms.keys())) + for key in keys: + if key in synonyms: + print(f'{key}={synonyms[key]}') + else: + print(key) + DOCSTRING = ''' Etiquette CLI ============= @@ -490,6 +501,8 @@ Etiquette CLI {tag_breplace} +{tag_list} + At any time, you may add --silent, --quiet, --debug, --loud to change logging. You can add --yes to avoid the "Commit?" prompt. @@ -788,6 +801,13 @@ tag_breplace: > etiquette_cli.py tag_breplace replace_from replace_to '''.strip(), + +tag_list=''' +tag_list: + Show all tags in the database. + + > etiquette_cli.py tag_list +''' ) DOCSTRING = betterhelp.add_previews(DOCSTRING, SUB_DOCSTRINGS) @@ -928,6 +948,9 @@ def main(argv): p_tag_breplace.add_argument('--yes', dest='autoyes', action='store_true') p_tag_breplace.set_defaults(func=tag_breplace_argparse) + p_tag_list = subparsers.add_parser('tag_list', aliases=['tag-list']) + p_tag_list.set_defaults(func=tag_list_argparse) + ## def pp(args):