Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
"""
Take the first CLI argument and describe the corresponding word
"""
# handle the --version switch
if '--version' in sys.argv or '-V' in sys.argv:
print('duden ' + __version__)
sys.exit(0)
# parse normal arguments
args = parse_args()
# search all words matching the string
words = search(args.word, return_words=False, exact=not args.fuzzy,
cache=args.cache)
# exit if the word wasn't found
if not words:
print(red(_("Word '{}' not found")).format(args.word))
sys.exit(1)
# list the options when there is more than one matching word
if len(words) > 1 and args.result is None:
print(_('Found {} matching words. Use the -r/--result argument to '
'specify which one to display.').format(white(len(words),
bold=True)))
for i, word in enumerate(words, 1):
print('{} {}'.format(blue('{})'.format(i)), word))
sys.exit(1)