summaryrefslogtreecommitdiff
path: root/archivist/cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'archivist/cli.py')
-rw-r--r--archivist/cli.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/archivist/cli.py b/archivist/cli.py
index 7bdf213..cfefd62 100644
--- a/archivist/cli.py
+++ b/archivist/cli.py
@@ -63,7 +63,8 @@ def prefix():
@tag.command('list')
@click.argument('pattern', required = False)
-def list_tags(pattern):
+@click.option('--full', is_flag=True, help="Print implications")
+def list_tags(pattern, full):
from .model import Tag
print("Tags")
@@ -79,6 +80,10 @@ def list_tags(pattern):
descr = t.description or ''
if descr:
descr = '-- ' + descr
+ if full:
+ impls = ', '.join(str(i.implies_tag) for i in t.implications if not i.implies_tag.default)
+ if impls:
+ descr = descr + ' --> ' + impls
print(' *', t, descr)
@prefix.command('list')
@@ -261,7 +266,8 @@ def open_doc(id):
@doc.command('find')
@click.argument('tags', type=TAG, nargs=-1)
-def find_doc(tags):
+@click.option('--full', is_flag=True, help="Print tags")
+def find_doc(tags, full):
from .model import Document, DocumentTag, TagClosure, Tag
virtual_tags = []
@@ -291,4 +297,6 @@ def find_doc(tags):
query = query.where(reduce(op.and_, (p.virtual_query for p in virtual_tags)))
for doc in query.iterator():
- print("* ID %d -- %s" % (doc.id, doc.original_path))
+ if full:
+ tags = ' --> ' + ', '.join(str(t.tag) for t in doc.tags)
+ print(f"* ID {doc.id} -- {doc.original_path}{tags}")