summaryrefslogtreecommitdiff
path: root/cli/commands/api/category.py
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-03-31 20:12:34 +0200
committerJules Laplace <julescarbon@gmail.com>2020-03-31 20:12:34 +0200
commit2b407d1f4a608d0ac23592ff16def77797e4fa41 (patch)
tree44d7b146d56d083e9d1c9fd2979831ea14d19334 /cli/commands/api/category.py
init thesaurus api client
Diffstat (limited to 'cli/commands/api/category.py')
-rw-r--r--cli/commands/api/category.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/commands/api/category.py b/cli/commands/api/category.py
new file mode 100644
index 0000000..5b688f0
--- /dev/null
+++ b/cli/commands/api/category.py
@@ -0,0 +1,19 @@
+"""
+Browse a category
+"""
+
+import click
+import simplejson as json
+
+from app.thesaurus.api import Thesaurus
+
+@click.command()
+@click.option('-c', '--id', 'opt_cat_id', required=True,
+ help='Category ID')
+@click.pass_context
+def cli(ctx, opt_cat_id):
+ """Browse a category
+ """
+ thesaurus = Thesaurus()
+ results = thesaurus.category(opt_cat_id)
+ print(json.dumps(results, indent=2))