Add HelpTopic inventory type for non-command help entries#189
Conversation
Introduces a compile-time registry for free-form help topics that are
not tied to a command handler — channel modes, user modes, or any other
concept a user might query with HELP <topic>.
Topics are registered at the call site via inventory::submit!:
inventory::submit!(HelpTopic {
topic: "CMODE_SECRET",
lines: &[
"CMODE_SECRET (+s)",
"",
"Marks the channel as secret.",
],
});
CommandDispatcher gains two new methods:
- get_help_topic(topic) -> Option<&'static [&'static str]>
- iter_help_topics() -> impl Iterator<Item = &'static HelpTopic>
ClientServer forwards both so command handlers can call them directly.
A HELP handler (see Libera-Chat#129) should query the command registry for
command docs and fall back to get_help_topic() for concept entries,
giving full coverage with no runtime I/O.
|
Sounds good, but this doesn't seem to be actually exposed to users. And don't we want to use files instead? It has the extra benefit of being configurable |
|
my plan, when I get back to it, was probably files. |
|
Hi, The main reason for the A file-based approach would add runtime I/O, deployment concerns (where do files live, are they bundled, what if they're missing), and a separate configuration surface that the rest of the codebase doesn't have. That said, this is just the registry infrastructure — if the consensus is to go file-based, it's straightforward to swap the backend later without changing how What do you guys think? |
|
CommandRegistration is not configurable because it would require users to change the code.
Solanum loads them on startup and rehash by listing a directory. |
|
I'll rework it to be file-based. Will work on it this weekend. |
|
who will work on it, you or claudegpt? |
|
Claude will do the heavy work. Any concerns on that?
…On Sat, Apr 18, 2026 at 1:52 PM internet-catte ***@***.***> wrote:
*internet-catte* left a comment (Libera-Chat/sable#189)
<#189?email_source=notifications&email_token=ABQBYX6EUKKIPBRSFSSK3DL4WPTJFA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRXGQ2TIMZZGU22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4274543955>
who will work on it, you or claudegpt?
—
Reply to this email directly, view it on GitHub
<#189?email_source=notifications&email_token=ABQBYX6EUKKIPBRSFSSK3DL4WPTJFA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRXGQ2TIMZZGU22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4274543955>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQBYX4ANFFHMRM5VNBPGQT4WPTJFAVCNFSM6AAAAACX6CD74OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DENZUGU2DGOJVGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
As mentioned above, this is the wrong way to do this. |
Context
PR #129 is implementing the
HELPcommand and identified an open question: command docs (extracted from doc comments by thecommand_handlermacro) cover command-specific topics, but there is no place to register help text for concepts — channel modes, user modes, ISUPPORT tokens, and so on.What this PR adds
A
HelpTopictype using the sameinventorypattern already used byCommandRegistration, providing a compile-time registry for free-form help entries.Usage
Register a topic anywhere in the codebase with
inventory::submit!:Look it up in a command handler:
New API
CommandDispatcherget_help_topic(topic: &str) -> Option<&'static [&'static str]>— case-insensitive lookupiter_help_topics() -> impl Iterator<Item = &'static HelpTopic>— enumerate all topics (for listing)ClientServer— thin forwards to the above, so command handlers don't need to reach into the dispatcher directly.How a HELP handler should combine both registries
Changes
sable_ircd/src/command/dispatcher.rs—HelpTopicstruct,inventory::collect!(HelpTopic), two methods onCommandDispatchersable_ircd/src/server/mod.rs— forwarding methods onClientServer