#!/usr/bin/python

"""
VIKI: more than a GUI for ROS, https://github.com/UT-RAM/viki 
version: 0.2 - Alice
copyright: Robin Hoogervorst, Alex Kamphuis, Cees Trouwborst, 2016 
licensed under the MIT License
"""

"""
    Entry point for the VIKI command line,
    parses the arguments and uses a mapping to execute the right stuff
"""

import argparse
from core.cli import runnables

parser = argparse.ArgumentParser()

# Mapping: option -> function, to add extra functions
run_functions = {
    'run': runnables.run,
    'configure':  runnables.configure,
    'check-packages': runnables.check_packages,
    'install-packages': runnables.install_packages,
    'add-module-repository': runnables.add_module_repository
}

# Parsing arguments using argparse
parser.add_argument('method', nargs='?', default='run', choices=run_functions.keys(), help="Command for VIKI to run")
parser.add_argument('options', nargs='*', help="Extra options for the method used")

args = parser.parse_args()

"""
    Using the mapping from above, we can run functions from the runnables package,
    this python module provides the actual functionality for the command line
"""
run_functions[args.method](args.options)
