import sys


def run_node_or_hub():
    run_function = None
    try:
        from klon_hub.main import run
        run_function = run
    except ImportError:
        pass

    try:
        from klon_node.main import run
        if run_function is not None:
            sys.exit(
                "Both klon-node and klon-hub are installed. Use klon-node and klon-hub commands instead."
            )
        run_function = run
    except ImportError:
        pass

    if run_function is None:
        sys.exit(
            "Install either klon-node or klon-hub to use this command as a shortcut."
        )

    run_function()
