From c770c1e39d43abca1856949de51360053236ea7c Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 21 Jul 2025 11:47:50 +1200 Subject: [PATCH] Docs: Improve cmd index Lists all commands with their short help. Also link to it. --- docs/source/cmd_ref.rst | 2 ++ docs/util/custom_directives.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/source/cmd_ref.rst b/docs/source/cmd_ref.rst index 20915d6dc..668516a0b 100644 --- a/docs/source/cmd_ref.rst +++ b/docs/source/cmd_ref.rst @@ -12,6 +12,8 @@ Command reference .. todo:: Can we warn on command groups that aren't included anywhere? +:ref:`List of all commands` + .. toctree:: :maxdepth: 2 diff --git a/docs/util/custom_directives.py b/docs/util/custom_directives.py index e8c400047..b90584aa7 100644 --- a/docs/util/custom_directives.py +++ b/docs/util/custom_directives.py @@ -474,7 +474,7 @@ class TagIndex(Index): lis.append(( dispname, 0, docname, anchor, - docname, '', typ + '', '', '' )) ret = [(k, v) for k, v in sorted(content.items())] @@ -513,18 +513,19 @@ class CommandIndex(Index): Qualifier and description are not rendered e.g. in LaTeX output. """ - content = {} + content: dict[str, list[tuple]] = {} items = ((name, dispname, typ, docname, anchor) for name, dispname, typ, docname, anchor, prio in self.domain.get_objects() if typ == self.name) items = sorted(items, key=lambda item: item[0]) for name, dispname, typ, docname, anchor in items: + title = self.domain.data['obj2title'].get(name) lis = content.setdefault(self.shortname, []) lis.append(( dispname, 0, docname, anchor, - '', '', typ + '', '', title )) ret = [(k, v) for k, v in sorted(content.items())]