#!/usr/bin/env python

from __future__ import annotations

import os
import sys


def main() -> None:
    try:
        import law  # noqa: F401
    except ImportError:
        # detect the law src directory relative to this file assuming a specific directory structure
        deploy_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
        if os.path.isdir(os.path.join(deploy_dir, "src", "law")):
            sys.path.insert(0, os.path.join(deploy_dir, "src"))
        import law  # noqa: F401

    # load the law cli
    from law.cli import run
    run()


if __name__ == "__main__":
    main()
