Skip to content

smelt.cmd

Tier: Mixed - Contains both Host and UiHost functions; each function below lists its exact tier.

Classification: Supported - Primary alpha facade for user config and plugins.

Register and list slash commands. cmd.run is injected by the TUI layer so it can access the live app state.

smelt.cmd.list

fun(): table

Tier: Host - Available in every runtime, including headless mode.

Return every registered slash command as a Lua array of { name, desc, args, busy, startup_ok, hidden } rows. Sorted by name.

smelt.cmd.register

fun(name: string, handler: fun(value: string?), opts: smelt.cmd.RegisterOpts?): smelt.Reg

Types: smelt.cmd.RegisterOpts, smelt.Reg

Tier: Host - Available in every runtime, including headless mode.

Register a slash command name whose handler is invoked when the user runs it. opts accepts desc, args, busy (run, reject, queue_request, or queue_command; default run), startup_ok (default false), hidden (default false), and override (default false). Returns a Reg whose :remove() unregisters the command.

smelt.cmd.register_picker

fun(name: string, opts: table?): nil

Tier: Host - Available in every runtime, including headless mode.

Register a slash command name that opens a prompt-docked picker when called without arguments, or invokes opts.apply(arg) directly when given one. opts accepts desc, args, items (an array or producer function), apply, prepare, on_select, on_enter, on_dismiss, stay_open, busy, and startup_ok. With stay_open = true, the item producer is re-evaluated after each Enter action. Returns nothing; the command lives until /reload.

smelt.cmd.run

fun(line: string): nil

Tier: UiHost - Requires a terminal UI; calling these from headless mode raises.

Schedule the slash-command line line (with or without leading /) as if the user had typed it. The app executes it after the current Lua callback returns. Errors are surfaced as in-app notifications.