Skip to main content

Module commands

Module commands 

Source
Expand description

The slash commands, in one table.

The plain REPL, the full-screen interface, /help, and Tab completion all read COMMANDS. Before this the set lived in three places — the REPL’s match, the interface’s match, and two hand-written /help strings — and they had already drifted: the REPL’s help named four commands and the interface’s named seven.

What the table does not hold is what a command does. Each front end keeps a plain match on the canonical name, because the handlers need different things (the REPL prints, the interface posts notes and asks its loop to open pickers, the server answers with events), and a table of closures would need a shared context type that fits none of them. The drift test in each front end closes the gap instead: every command the table says it serves must be handled there.

It lives here, in core, because there are three front ends now. The dashboard parses the same lines (#254), and a table the server cannot read is a table the browser has to copy.

Structs§

Command

Enums§

Args
Whether a command takes an argument, and how /help spells it.
Completion
Front
Which interface has a command.
Parsed
A line that starts with /, resolved against what front has.

Constants§

COMMANDS
Every slash command, in the order /help and the menu list them.

Functions§

complete
What Tab does to line. Only while the command word is being typed: the line starts with / and has no whitespace yet. Anything else — prose, or an argument — is None, so Tab stays whatever the editor already made it.
help
The /help body for front: one line per command, in table order.
is_command_word
Whether line is a command word being typed: a leading / and no whitespace yet.
lookup
The command a word names, by canonical name or alias, exactly.
matching
The commands whose name or an alias starts with prefix, in table order, that front has.
parse