summaryrefslogtreecommitdiff
path: root/cli/commands/api/search.py
blob: 3c0dc0ec133b6e5210de9be4ccf6b9226ad90f63 (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('-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))