f
This commit is contained in:
26
CLI.py
26
CLI.py
@@ -7,6 +7,28 @@ This module intentionally uses a class-based architecture:
|
||||
- all REPL/pipeline/cmdlet execution state lives on objects
|
||||
"""
|
||||
|
||||
# When running the CLI directly (not via the 'mm' launcher), honor the
|
||||
# repository config `debug` flag by enabling `MM_DEBUG` so import-time
|
||||
# diagnostics and bootstrap debug output are visible without setting the
|
||||
# environment variable manually.
|
||||
import os
|
||||
from pathlib import Path
|
||||
if not os.environ.get("MM_DEBUG"):
|
||||
try:
|
||||
conf_path = Path(__file__).resolve().parent / "config.conf"
|
||||
if conf_path.exists():
|
||||
for ln in conf_path.read_text(encoding="utf-8").splitlines():
|
||||
ln_strip = ln.strip()
|
||||
if ln_strip.startswith("debug"):
|
||||
parts = ln_strip.split("=", 1)
|
||||
if len(parts) >= 2:
|
||||
val = parts[1].strip().strip('"').strip("'").strip().lower()
|
||||
if val in ("1", "true", "yes", "on"):
|
||||
os.environ["MM_DEBUG"] = "1"
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
import json
|
||||
import re
|
||||
import shlex
|
||||
@@ -1325,7 +1347,7 @@ class CmdletExecutor:
|
||||
console = Console()
|
||||
|
||||
|
||||
class MedeiaCLI:
|
||||
class CLI:
|
||||
"""Main CLI application object."""
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
@@ -2469,4 +2491,4 @@ Come to love it when others take what you share, as there is no greater joy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
MedeiaCLI().run()
|
||||
CLI().run()
|
||||
|
||||
Reference in New Issue
Block a user