def handle_commands(args):
    """ Core handler for redirecting to the proper commands."""

    # print args
    from werckercli.commands.create import create\
        as command_create
    from werckercli.commands.project import project_list\
        as command_project_list
    from werckercli.commands.project import project_link\
        as command_project_link
    from werckercli.commands.project import project_build\
        as command_project_build
    from werckercli.commands.build import build_list\
        as command_builds_list
    from werckercli.commands.build import build_deploy\
        as command_builds_deploy
    from werckercli.commands.target import add\
        as command_add
    from werckercli.commands.target import list_by_project\
        as command_list_by_project
    from werckercli.commands.target import link_to_deploy_target\
        as command_target_details
    from werckercli.commands.clearsettings import clear_settings\
        as command_clear_settings
    from werckercli.commands.login import login\
        as command_login
    from werckercli.commands.project import project_list_queue\
        as command_list_jobs
    from werckercli.commands.project import project_open\
        as command_project_open
    from werckercli.commands.services import search_services\
        as command_search_services
    from werckercli.commands.services import info_service\
        as command_info_service
    from werckercli.commands.services import list_services\
        as command_list_services
    from werckercli.commands.update import update\
        as command_update
    from werckercli.commands.validate import validate\
        as command_validate
    from werckercli.commands.services import add_service\
        as command_add_service
    from werckercli.commands.services import remove_service\
        as command_remove_service

    try:
        if args.get('apps') and args.get('create'):
            command_create()
        elif args.get('create'):
            command_create()
        elif args.get('status'):
            command_builds_list(limit=1)
        elif args.get('deploy'):
            command_builds_deploy()
        elif args.get('apps'):
            # if args['list']:
            if args.get('build'):
                command_project_build()
            else:
                command_project_list()
        elif args.get('link'):
            command_project_link()
            # elif args.get("build"):
            #     command_project_build()
        elif args.get("builds"):
            # if args['list']:
            command_builds_list()
            # if args['deploy']:
                # command_builds_deploy()
        elif args.get('targets'):
            if args.get('add'):
                command_add()
            elif args.get('list'):
                command_list_by_project()
            elif args.get('details') or args.get('open'):
                command_target_details()
        elif args.get('open'):
            command_project_open()
        elif args.get('validate'):
            command_validate()
        elif args.get('login'):
            command_login()
        elif args.get('logout'):
            command_clear_settings()
        elif args.get('services'):
            if args.get('search'):
                command_search_services(args.get('<name>'))
            elif args.get('info'):
                version = args.get('<version>')

                if version is None:
                    version = 0

                command_info_service(
                    args.get('<name>'),
                    version=version
                )
            elif args.get('add'):
                version = args.get('<version>')
                if version is None:
                    version = 0

                command_add_service(
                    args.get('<name>'),
                    version=version
                )
            elif args.get('remove'):
                command_remove_service(
                    args.get('<name>'),
                )
            else:
                command_list_services()

        elif args.get('queue'):
            command_list_jobs()
        elif args.get('update'):
            command_update()
    except __HOLE__:
        puts("\nAborted...")
dataset/ETHPy150Open wercker/wercker-cli/werckercli/cli.py/handle_commands