Skip to content

smelt.shell

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

Visibility: Public - Stable Lua API intended for user config and plugins.

Shell command splitting and interactive/background-operator validators.

smelt.shell.check_background_op

fun(command: string): string?

Return a user-facing error message if command uses the shell & background operator, or nil otherwise.

smelt.shell.check_interactive

fun(command: string): string?

Return a user-facing error message if command would invoke an interactive program (editor, REPL, pager, git -i, etc.), or nil if it is safe to run non-interactively.

smelt.shell.extract_paths

fun(command: string): string[]

Extract filesystem paths referenced by command for workspace permission checks.

smelt.shell.has_output_redirection

fun(command: string): boolean

Return true when command contains shell output redirection such as > or >>.

smelt.shell.split

fun(command: string): string[]

Split command into the sequence of subcommands separated by shell operators (;, &&, ||, |). Operators themselves are dropped.

smelt.shell.split_with_ops

fun(command: string): table

Split command into subcommands and pair each with the operator that followed it. Returns rows of { command = string, op = string? }.