Insert a new entry at the top of a specific section.
(lines: list[str], heading: str, entry: str)
| 883 | |
| 884 | |
| 885 | def _insert_section_entry(lines: list[str], heading: str, entry: str) -> bool: |
| 886 | """Insert a new entry at the top of a specific section.""" |
| 887 | bounds = _get_section_bounds(lines, heading) |
| 888 | if bounds is None: |
| 889 | return False |
| 890 | |
| 891 | start, _ = bounds |
| 892 | lines.insert(start, entry) |
| 893 | return True |
| 894 | |
| 895 | |
| 896 | def _remove_section_entry(lines: list[str], heading: str, link: str) -> bool: |
no test coverage detected