Module hilbish.runner
The runner interface contains functions that allow the user to change
Introduction#
how Hilbish interprets interactive input. Users can add and change the default runner for interactive input to any language or script of their choosing. A good example is using it to write commands in Fennel.
Functions#
hilbish.runner.add(name, runner): Adds a runner to the table of available runners.hilbish.runner.exec(cmd, runnerName) -> table: Executescmdwith a runner.hilbish.runner.get(name) -> table: Get a runner by name.hilbish.runner.getCurrent() -> string: Returns the current runner by name.hilbish.runner.lua(input) -> table: Evaluatescmdas Lua input. This is the same as usingdofilehilbish.runner.run(input, priv): Runsinputwith the currently set Hilbish runner.hilbish.runner.set(name, runner): Sets a runner by name. The difference between this function andhilbish.runner.setCurrent(name): Sets Hilbish's runner mode by name.hilbish.runner.sh(input) -> table: Runs input using Hilbish's snail instance, that is, as shell script.
add#
hilbish.runner.add(name, runner)
Adds a runner to the table of available runners.
runner must be a table with both a run and a validate function.
Parameters#
string name
Name of the runner
table runner
exec#
hilbish.runner.exec(cmd, runnerName) -> table
Executes cmd with a runner.
If runnerName is not specified, it uses the default Hilbish runner.
Parameters#
string cmd
string? runnerName
get#
hilbish.runner.get(name) -> table
Get a runner by name.
Parameters#
string name
Name of the runner to retrieve.
getCurrent#
hilbish.runner.getCurrent() -> string
Returns the current runner by name.
Parameters#
This function has no parameters.
lua#
hilbish.runner.lua(input) -> table
Evaluates cmd as Lua input. This is the same as using dofile
or load, but is appropriated for the runner interface.
Parameters#
string input
run#
hilbish.runner.run(input, priv)
Runs input with the currently set Hilbish runner.
This method is how Hilbish executes commands.
priv is an optional boolean used to state if the input should be saved to history.
Parameters#
string input
boolean priv?
set#
hilbish.runner.set(name, runner)
Sets a runner by name. The difference between this function and
add, is set will not check if the named runner exists.
The runner table must have both a run and a validate function.
Parameters#
string name
table runner
setCurrent#
hilbish.runner.setCurrent(name)
Sets Hilbish's runner mode by name.
Parameters#
string name
sh#
hilbish.runner.sh(input) -> table
Runs input using Hilbish's snail instance, that is, as shell script.
Parameters#
string input