interfaces and functions which directly relate to shell functionality.</p><h3id=interface-fields>Interface fields</h3><ul><li><code>ver</code>: The version of Hilbish</li><li><code>user</code>: Username of the user</li><li><code>host</code>: Hostname of the machine</li><li><code>dataDir</code>: Directory for Hilbish data files, including the docs and default modules</li><li><code>interactive</code>: Is Hilbish in an interactive shell?</li><li><code>login</code>: Is Hilbish the login shell?</li><li><code>vimMode</code>: Current Vim input mode of Hilbish (will be nil if not in Vim input mode)</li><li><code>exitCode</code>: xit code of the last executed command</li></ul><h3id=functions>Functions</h3><h4id=aliascmd-orig>alias(cmd, orig)</h4><p>Sets an alias of <code>cmd</code> to <code>orig</code></p><h4id=appendpathdir>appendPath(dir)</h4><p>Appends <code>dir</code> to $PATH</p><h4id=completescope-cb>complete(scope, cb)</h4><p>Registers a completion handler for <code>scope</code>.
A <code>scope</code> is currently only expected to be <code>command.<cmd></code>,
replacing <cmd>with the name of the command (for example <code>command.git</code>).
<code>cb</code> must be a function that returns a table of “completion groups.”
Check <code>doc completions</code> for more information.</p><h4id=cwd>cwd()</h4><p>Returns the current directory of the shell</p><h4id=execcmd>exec(cmd)</h4><p>Replaces running hilbish with <code>cmd</code></p><h4id=gorofn>goro(fn)</h4><p>Puts <code>fn</code> in a goroutine</p><h4id=highlighterline>highlighter(line)</h4><p>Line highlighter handler. This is mainly for syntax highlighting, but in
reality could set the input of the prompt to <em>display</em> anything. The
callback is passed the current line and is expected to return a line that
will be used as the input display.</p><h4id=hinterline-pos>hinter(line, pos)</h4><p>The command line hint handler. It gets called on every key insert to
determine what text to use as an inline hint. It is passed the current
line and cursor position. It is expected to return a string which is used
as the text for the hint. This is by default a shim. To set hints,
override this function with your custom handler.</p><h4id=inputmodemode>inputMode(mode)</h4><p>Sets the input mode for Hilbish’s line reader. Accepts either emacs or vim</p><h4id=intervalcb-time>interval(cb, time)</h4><p>Runs the <code>cb</code> function every <code>time</code> milliseconds.
Returns a <code>timer</code> object (see <code>doc timers</code>).</p><h4id=multipromptstr>multiprompt(str)</h4><p>Changes the continued line prompt to <code>str</code></p><h4id=prependpathdir>prependPath(dir)</h4><p>Prepends <code>dir</code> to $PATH</p><h4id=promptstr-typ>prompt(str, typ)</h4><p>Changes the shell prompt to <code>str</code>
There are a few verbs that can be used in the prompt text.
These will be formatted and replaced with the appropriate values.
<code>%h</code> - Hostname of device</p><h4id=readprompt---input-string>read(prompt) -> input (string)</h4><p>Read input from the user, using Hilbish’s line editor/input reader.
Returns <code>input</code>, will be nil if ctrl + d is pressed, or an error occurs (which shouldn’t happen)</p><h4id=runcmd-returnout---exitcode-number-stdout-string-stderr-string>run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string)</h4><p>Runs <code>cmd</code> in Hilbish’s sh interpreter.
If returnOut is true, the outputs of <code>cmd</code> will be returned as the 2nd and
3rd values instead of being outputted to the terminal.</p><h4id=runnermodemode>runnerMode(mode)</h4><p>Sets the execution/runner mode for interactive Hilbish. This determines whether
Hilbish wll try to run input as Lua and/or sh or only do one of either.
Accepted values for mode are hybrid (the default), hybridRev (sh first then Lua),
sh, and lua. It also accepts a function, to which if it is passed one
will call it to execute user input instead.</p><h4id=timeoutcb-time>timeout(cb, time)</h4><p>Runs the <code>cb</code> function after <code>time</code> in milliseconds