summaryrefslogtreecommitdiff
path: root/cli/commands/api/search.py
blob: cdff05349246e3719fb558360e24e7adc0deb059 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""
Search for a word
"""

import click
import simplejson as json

from app.thesaurus.api import Thesaurus

@click.command()
@click.option('-i', '--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))