def run(action: str, args: dict) -> int:
    """
    Runs the specified command action and returns the return status code
    for exit.
    
    :param action:
        The action to run
    :param args:
        The arguments parsed for the specified action
    """
    if args.get('show_version_info'):
        return run_version(args)

    actions = dict(
        shell=run_shell,
        kernel=run_kernel,
        serve=run_kernel,
        version=run_version
    )

    if action not in actions:
        print('[ERROR]: Unrecognized sub command "{}"'.format(action))
        parser = args['parser']  # type: ArgumentParser
        parser.print_help()
        return 1

    return actions.get(action)(args)