#!/usr/bin/env python3
import importlib.util
import sys
from pathlib import Path


ROOT = Path(__file__).resolve().parent
REQUIRED_MODULES = {
    "PIL": "Pillow",
}


def missing_dependencies():
    return [package for module, package in REQUIRED_MODULES.items() if importlib.util.find_spec(module) is None]


missing = missing_dependencies()
if missing:
    print("Missing Python dependency:", file=sys.stderr)
    for package in missing:
        print(f"  - {package}", file=sys.stderr)
    print("\nInstall it with:", file=sys.stderr)
    print(f"  {sys.executable} -m pip install " + " ".join(missing), file=sys.stderr)
    raise SystemExit(1)

sys.path.insert(0, str(ROOT))

from scripts.cli import main


if __name__ == "__main__":
    main()
