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

Function _make_manpage_from_source

tests/test_manager.py:86–95  ·  view source on GitHub ↗

Create a ParsedManpage from a source path like 'distro/release/1/name.1.gz'.

(source: str)

Source from the content-addressed store, hash-verified

84
85
86def _make_manpage_from_source(source: str) -> ParsedManpage:
87 """Create a ParsedManpage from a source path like 'distro/release/1/name.1.gz'."""
88 basename = os.path.basename(source) # e.g. "name.1.gz"
89 name_with_section = basename[:-3] # strip ".gz" -> "name.1"
90
91 name, section = name_section(name_with_section)
92 parts = source.split("/")
93 distro = parts[0] if len(parts) >= 4 else "distro"
94 release = parts[1] if len(parts) >= 4 else "release"
95 return _make_manpage(name, section=section, distro=distro, release=release)
96
97
98# ---------------------------------------------------------------------------

Callers 4

_fake_runMethod · 0.85
_fake_runMethod · 0.85
_fake_runMethod · 0.85

Calls 2

name_sectionFunction · 0.90
_make_manpageFunction · 0.70

Tested by

no test coverage detected