Skip to content

CommandRegistry

Methods

add

CommandRegistry:add(spec)

Register a command from a { name, about, args, run, ... } table.

Parameters

  • spec: {name: string, about: string, aliases: {[integer]: string}?, args: {[integer]: {name: string, help: string?, required: boolean?, long: string?, short: string?, flag: boolean?, multiple: boolean?}}?, run: (ctx: CommandCtx, args: any) -> CommandAction?}
    • name — The verb the command is invoked as, without the leading /.
    • about — One-line description shown in /help and the command's own --help.
    • aliases — Alternate verbs that also invoke the command.
    • args — The command's declared arguments, in the order clap should expect any positionals.
    • run — The command body, called with a run context and the parsed arguments.