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

Function resolve_mandoc_version

explainshell/extraction/common.py:105–120  ·  view source on GitHub ↗

Identify the mandoc binary that produced an extraction. Returns one of: ``repo: `` tracked tools/mandoc-md, clean working tree. ``repo:dirty: `` tools/mandoc-md but modified vs HEAD. ``custom: `` any other binary (system mandoc, en

(binary_path: str)

Source from the content-addressed store, hash-verified

103
104
105def resolve_mandoc_version(binary_path: str) -> str | None:
106 """Identify the mandoc binary that produced an extraction.
107
108 Returns one of:
109 ``repo:<short-sha>`` tracked tools/mandoc-md, clean working tree.
110 ``repo:dirty:<sha256-pfx>`` tools/mandoc-md but modified vs HEAD.
111 ``custom:<sha256-pfx>`` any other binary (system mandoc, env override).
112 ``None`` binary cannot be located.
113 """
114 located = shutil.which(binary_path) or binary_path
115 try:
116 abs_path = str(Path(located).resolve(strict=True))
117 except (OSError, RuntimeError):
118 return None
119 st = os.stat(abs_path)
120 return _resolve_mandoc_version_cached(abs_path, (st.st_mtime, st.st_size))

Callers 1

build_raw_manpageFunction · 0.85

Calls 1

Tested by

no test coverage detected