Files
inventory_analytics/scripts/sync_channel_inventory.py
T

30 lines
731 B
Python
Raw Normal View History

2026-04-29 14:06:41 +08:00
#!/usr/bin/env python3
2026-05-07 18:29:45 +08:00
from pathlib import Path
2026-04-29 14:06:41 +08:00
import sys
2026-05-07 18:29:45 +08:00
def _bootstrap_project_root() -> None:
project_root = Path(__file__).resolve().parents[1]
project_root_text = str(project_root)
if project_root_text not in sys.path:
sys.path.insert(0, project_root_text)
_bootstrap_project_root()
2026-04-29 14:06:41 +08:00
from inventory_analytics.channel_inventory_sync.entrypoint import main
def _ensure_default_action() -> None:
2026-05-07 18:29:45 +08:00
if any(arg in {"-h", "--help"} for arg in sys.argv[1:]):
return
2026-04-29 14:06:41 +08:00
if any(arg == "--action" or arg.startswith("--action=") for arg in sys.argv[1:]):
return
sys.argv.extend(["--action", "all"])
if __name__ == "__main__":
_ensure_default_action()
raise SystemExit(main())