Return distinct section directories for a distro/release. Extracts the third path component from source keys matching ``distro/release/...`` using a range scan on the primary key.
(self, distro: str, release: str)
| 632 | return SubcommandMappingResult(mappings_to_add, parents) |
| 633 | |
| 634 | def list_sections(self, distro: str, release: str) -> list[str]: |
| 635 | """Return distinct section directories for a distro/release. |
| 636 | |
| 637 | Extracts the third path component from source keys matching |
| 638 | ``distro/release/...`` using a range scan on the primary key. |
| 639 | """ |
| 640 | prefix = f"{distro}/{release}/" |
| 641 | offset = len(prefix) |
| 642 | rows = self._conn.execute( |
| 643 | "SELECT DISTINCT SUBSTR(source, ?, INSTR(SUBSTR(source, ?), '/') - 1) AS section " |
| 644 | "FROM manpages WHERE source >= ? AND source < ? " |
| 645 | "ORDER BY section", |
| 646 | (offset + 1, offset + 1, prefix, prefix[:-1] + chr(ord(prefix[-1]) + 1)), |
| 647 | ).fetchall() |
| 648 | return [row["section"] for row in rows] |
| 649 | |
| 650 | def list_manpages(self, prefix: str) -> list[str]: |
| 651 | """List source paths that start with *prefix*. |
no outgoing calls