#!/usr/bin/env python

import click
from src import app, VERSION, config


@click.command()
@click.option('--test', is_flag=True, help='Run testing function', default=False, )
@click.option('--version', '-v', is_flag=True, help='Check version', default=False, )
@click.option('--update', is_flag=True, help='Check for update', default=False, )
@click.option('--show-command', is_flag=True, help='Show Command', default=False, )
@click.argument('input', type=click.File('r'), default=None, required=False)
def exec(test: str, version: str, update: str, show_command: bool, input: click.File):
  config.app["show-command"] = show_command

  if test:
    app.test()
  elif version:
    print(f'v: {VERSION}')
  elif update:
    app.update()
  else:
    app.main([input.name])


exec()
