"""PyInstaller / Windows 엔트리 — 인자 없으면 GUI, 있으면 CLI.""" from __future__ import annotations import os import sys def main() -> int: argv = sys.argv[1:] backend_only = "--backend" in argv if backend_only: argv = [a for a in argv if a != "--backend"] # Tauri shell loads http://127.0.0.1:8765 — no external browser if backend_only or os.environ.get("JUC500_TAURI", "").strip().lower() in ( "1", "true", "yes", ): from juc500_xfer.gui_server import run_gui run_gui(open_browser=False) return 0 # 더블클릭 / 바로가기: GUI (legacy — browser or Tauri) if not argv: if os.environ.get("JUC500_USE_TAURI", "").strip().lower() in ("1", "true", "yes"): # Tauri launcher should spawn us with --backend; fallback to HTTP-only. from juc500_xfer.gui_server import run_gui run_gui(open_browser=False) return 0 from juc500_xfer.gui_server import run_gui run_gui(open_browser=True) return 0 # 하위 호환: 첫 인자가 옵션이 아니면 CLI from juc500_xfer.cli import main as cli_main return cli_main(argv) if __name__ == "__main__": raise SystemExit(main())