tui.cmd.add
tui.cmd.add ID TITLE ACTION [--group G] [--desc TEXT] [--when FN] [--key KEY]
Registers a command in the command palette.
Parameters
ID: unique command id. Adding an existingIDreplaces it.TITLE: what the palette shows and searches.ACTION: function plus arguments, chained with;if needed. Same rules as atui.bindcommand.
Options
--group G: heading the command is listed under.--desc TEXT: second line in the palette.--when FN: the command is listed only whileFNreturns0.--key KEY: also bindsKEYto the command; the palette shows it as the hint.
Returns: 1 when ID, TITLE or ACTION is missing.
Notes
- Commands added while a plugin loads are removed when that plugin is disabled, and show the plugin’s name as their hint.
Example
tui.cmd.add export "Export report" on_export --group App --desc "Write report.csv" --key ctrl+e
