#!/usr/bin/env python3
# This file is part of kytos-utils.
#
# Copyright (c) 2016-2017 by Kytos Team.
#
# Authors:
#    Beraldo Leal <beraldo AT ncc DOT unesp DOT br>

"""kytos - The kytos command line.

Usage: kytos [-c <file>|--config <file>] <command> [<args>...]
       kytos [-v|--version]
       kytos [-h|--help]

Options:
  -c <file>, --config <file>    Load config file [default: ~/.kytosrc]
  -h, --help                    Show this screen.
  -v, --version                 Show version.

The most commonly used kytos commands are:
   napps      Create, list, enable, install (and other actions) NApps.
   server     Start, Stop your Kytos Controller (Kytos)

See 'kytos <command> -h|--help' for more information on a specific command.
"""
import logging
from docopt import docopt

logging.basicConfig(format='%(levelname)-5s %(message)s', level=logging.INFO)

if __name__ == '__main__':
    args = docopt(__doc__,
                  version='kytos command line, version 2017.2b1',
                  options_first=True)
    command = args['<command>']
    command_args = args['<args>']
    argv = [command] + command_args

    if command == 'napps':
        from kytos.cli.commands.napps.parser import parse
        parse(argv)
    elif command == 'users':
        from kytos.cli.commands.users.parser import parse
        parse(argv)
    else:
        print("Error: Invalid syntax")
        exit(__doc__)
