Skip to content

WIP: implement HELP#129

Draft
internet-catte wants to merge 8 commits into
Libera-Chat:masterfrom
internet-catte:catte/help
Draft

WIP: implement HELP#129
internet-catte wants to merge 8 commits into
Libera-Chat:masterfrom
internet-catte:catte/help

Conversation

@internet-catte
Copy link
Copy Markdown
Contributor

this does not work, or even compile yet, but I wanted some advice/guidance.

my plan here is:

  1. document commands as doc comments
  2. grab the doc comment
  3. and store it somewhere (where?)
  4. return that for HELP cmd

Right now i've achieved 1 and 2, and have the mechanism of 4 mapped out, so the big question is how to link things up.

A similar method could be used for services help, but because of the limitations of HELP (topics can only be one word), this would have to be done in the typical services way (NS HELP subcmd, CS HELP subcmd). This might be doable in this PR once the details are ironed out.

Listing help topics is pretty straightforward, just get all the help topics and print them out. I've done it chunked to have something similar to solanum's output.

Comment thread sable_ircd/src/command/client_command.rs Outdated
gfnord added a commit to gfnord/sable that referenced this pull request Apr 18, 2026
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.
gfnord added a commit to gfnord/sable that referenced this pull request Apr 18, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant