-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
44 lines (35 loc) · 1.44 KB
/
Copy pathapp.py
File metadata and controls
44 lines (35 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from __future__ import annotations
import sys
def _configure_cli_output_encoding(*streams: object) -> None:
if not streams:
streams = (sys.stdout, sys.stderr)
for stream in streams:
reconfigure = getattr(stream, "reconfigure", None)
if reconfigure is None:
continue
try:
reconfigure(encoding="utf-8", errors="backslashreplace")
except (OSError, ValueError):
continue
_configure_cli_output_encoding()
from core.diagnostics.codes import explain_code
from core.diagnostics.runner import run_self_check
from core.gui import main, smoke_check
from core.mockserver.runner import run_mock_server_cli
if __name__ == "__main__":
# 이 파일은 실행 모드의 교차로입니다. GUI 실행 외에도 테스트/진단/mock 서버를
# 같은 EXE에서 바로 호출할 수 있게 CLI 옵션을 먼저 확인합니다.
if "--smoke-check" in sys.argv:
smoke_check()
elif "--mock-server" in sys.argv:
raise SystemExit(run_mock_server_cli(sys.argv[1:]))
elif "--explain-code" in sys.argv:
index = sys.argv.index("--explain-code")
code = sys.argv[index + 1] if len(sys.argv) > index + 1 else ""
print(explain_code(code))
elif "--diagnose" in sys.argv:
result = run_self_check()
print(f"진단 리포트: {result.reports.html}")
print(f"진단 티켓: {result.reports.ticket}")
else:
main()