MCPcopy Index your code
hub / github.com/idank/explainshell / _parse_mode

Function _parse_mode

explainshell/manager.py:83–97  ·  view source on GitHub ↗

Parse a mode value into (mode, model). Returns ("llm", " "). Raises ValueError on invalid input.

(raw: str | None)

Source from the content-addressed store, hash-verified

81
82
83def _parse_mode(raw: str | None) -> tuple[str | None, str | None]:
84 """Parse a mode value into (mode, model).
85
86 Returns ("llm", "<model>").
87
88 Raises ValueError on invalid input.
89 """
90 if raw is None:
91 return None, None
92 if raw.startswith("llm:"):
93 model = raw[4:]
94 if not model:
95 raise ValueError("llm:<model> requires a model name (e.g. llm:gpt-5-mini)")
96 return "llm", model
97 raise ValueError(f"invalid mode value: {raw!r} (expected 'llm:<model>')")
98
99
100# ---------------------------------------------------------------------------

Callers 3

extractFunction · 0.85
diff_db_cmdFunction · 0.85
diff_extractors_cmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected