diff options
Diffstat (limited to 'cli/commands/api/search.py')
| -rw-r--r-- | cli/commands/api/search.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/commands/api/search.py b/cli/commands/api/search.py new file mode 100644 index 0000000..3c0dc0e --- /dev/null +++ b/cli/commands/api/search.py @@ -0,0 +1,19 @@ +""" +Search for a word +""" + +import click +import simplejson as json + +from app.thesaurus.api import Thesaurus + +@click.command() +@click.option('-w', '--word', 'opt_word', required=True, + help='Word to search') +@click.pass_context +def cli(ctx, opt_word): + """Search for a word + """ + thesaurus = Thesaurus() + results = thesaurus.search(opt_word) + print(json.dumps(results, indent=2)) |
