MCPcopy Create free account
hub / github.com/idank/explainshell / _extract_section

Function _extract_section

explainshell/roff_utils.py:72–83  ·  view source on GitHub ↗

Extract lines between a section header and the next section header.

(lines: list[str], section_name: str)

Source from the content-addressed store, hash-verified

70
71
72def _extract_section(lines: list[str], section_name: str) -> list[str]:
73 """Extract lines between a section header and the next section header."""
74 result: list[str] = []
75 in_section = False
76 for line in lines:
77 if in_section:
78 if _is_any_section_header(line):
79 break
80 result.append(line)
81 elif _is_section_header(line, section_name):
82 in_section = True
83 return result
84
85
86# Matches "command" as a standalone word, case-insensitive

Callers 1

detect_nested_cmdFunction · 0.85

Calls 2

_is_any_section_headerFunction · 0.85
_is_section_headerFunction · 0.85

Tested by

no test coverage detected