interfaces and functions which directly relate to shell functionality.</p><h3id=functionsclass=heading>Functions
<ahref=#functionsclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><ahref=#alias>alias(cmd, orig)</a></td><td>Sets an alias of <code>cmd</code> to <code>orig</code></td></tr><tr><td><ahref=#appendPath>appendPath(dir)</a></td><td>Appends <code>dir</code> to $PATH</td></tr><tr><td><ahref=#complete>complete(scope, cb)</a></td><td>Registers a completion handler for <code>scope</code>.</td></tr><tr><td><ahref=#cwd>cwd() -> string</a></td><td>Returns the current directory of the shell</td></tr><tr><td><ahref=#exec>exec(cmd)</a></td><td>Replaces running hilbish with <code>cmd</code></td></tr><tr><td><ahref=#goro>goro(fn)</a></td><td>Puts <code>fn</code> in a goroutine</td></tr><tr><td><ahref=#highlighter>highlighter(line)</a></td><td>Line highlighter handler. This is mainly for syntax highlighting, but in</td></tr><tr><td><ahref=#hinter>hinter(line, pos)</a></td><td>The command line hint handler. It gets called on every key insert to</td></tr><tr><td><ahref=#inputMode>inputMode(mode)</a></td><td>Sets the input mode for Hilbish’s line reader. Accepts either emacs or vim</td></tr><tr><td><ahref=#interval>interval(cb, time) -> @Timer</a></td><td>Runs the <code>cb</code> function every <code>time</code> milliseconds.</td></tr><tr><td><ahref=#multiprompt>multiprompt(str)</a></td><td>Changes the continued line prompt to <code>str</code></td></tr><tr><td><ahref=#prependPath>prependPath(dir)</a></td><td>Prepends <code>dir</code> to $PATH</td></tr><tr><td><ahref=#prompt>prompt(str, typ)</a></td><td>Changes the shell prompt to <code>str</code></td></tr><tr><td><ahref=#read>read(prompt) -> input (string)</a></td><td>Read input from the user, using Hilbish’s line editor/input reader.</td></tr><tr><td><ahref=#run>run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string)</a></td><td>Runs <code>cmd</code> in Hilbish’s sh interpreter.</td></tr><tr><td><ahref=#runnerMode>runnerMode(mode)</a></td><td>Sets the execution/runner mode for interactive Hilbish. This determines whether</td></tr><tr><td><ahref=#timeout>timeout(cb, time) -> @Timer</a></td><td>Runs the <code>cb</code> function after <code>time</code> in milliseconds.</td></tr><tr><td><ahref=#which>which(name) -> string</a></td><td>Checks if <code>name</code> is a valid command.</td></tr></tbody></table><h3id=interface-fieldsclass=heading>Interface fields
<ahref=#interface-fieldsclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>ver</td><td>The version of Hilbish</td></tr><tr><td>goVersion</td><td>The version of Go that Hilbish was compiled with</td></tr><tr><td>user</td><td>Username of the user</td></tr><tr><td>host</td><td>Hostname of the machine</td></tr><tr><td>dataDir</td><td>Directory for Hilbish data files, including the docs and default modules</td></tr><tr><td>interactive</td><td>Is Hilbish in an interactive shell?</td></tr><tr><td>login</td><td>Is Hilbish the login shell?</td></tr><tr><td>vimMode</td><td>Current Vim input mode of Hilbish (will be nil if not in Vim input mode)</td></tr><tr><td>exitCode</td><td>xit code of the last executed command</td></tr></tbody></table><h3id=functions-1class=heading>Functions
<ahref=#aliasclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Sets an alias of <code>cmd</code> to <code>orig</code></p><h5id=parametersclass=heading>Parameters
<ahref=#parametersclass=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=appendPath><h4class=heading>hilbish.appendPath(dir)
<ahref=#appendPathclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Appends <code>dir</code> to $PATH</p><h5id=parameters-1class=heading>Parameters
<ahref=#parameters-1class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=complete><h4class=heading>hilbish.complete(scope, cb)
<ahref=#completeclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Registers a completion handler for <code>scope</code>.
<ahref=#parameters-2class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=cwd><h4class=heading>hilbish.cwd() -> string
<ahref=#cwdclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Returns the current directory of the shell</p><h5id=parameters-3class=heading>Parameters
<ahref=#parameters-3class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=exec><h4class=heading>hilbish.exec(cmd)
<ahref=#execclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Replaces running hilbish with <code>cmd</code></p><h5id=parameters-4class=heading>Parameters
<ahref=#parameters-4class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=goro><h4class=heading>hilbish.goro(fn)
<ahref=#goroclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Puts <code>fn</code> in a goroutine</p><h5id=parameters-5class=heading>Parameters
<ahref=#parameters-5class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=highlighter><h4class=heading>hilbish.highlighter(line)
<ahref=#highlighterclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Line highlighter handler. This is mainly for syntax highlighting, but in
<ahref=#parameters-6class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=hinter><h4class=heading>hilbish.hinter(line, pos)
<ahref=#hinterclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>The command line hint handler. It gets called on every key insert to
<ahref=#parameters-7class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=inputMode><h4class=heading>hilbish.inputMode(mode)
<ahref=#inputModeclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Sets the input mode for Hilbish’s line reader. Accepts either emacs or vim</p><h5id=parameters-8class=heading>Parameters
<ahref=#parameters-8class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=interval><h4class=heading>hilbish.interval(cb, time) -> <ahref=/Hilbish/docs/api/hilbish/hilbish.timers/#timerstyle=text-decoration:noneid=lol>Timer</a>
<ahref=#intervalclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Runs the <code>cb</code> function every <code>time</code> milliseconds.
<ahref=#parameters-9class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=multiprompt><h4class=heading>hilbish.multiprompt(str)
<ahref=#multipromptclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Changes the continued line prompt to <code>str</code></p><h5id=parameters-10class=heading>Parameters
<ahref=#parameters-10class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=prependPath><h4class=heading>hilbish.prependPath(dir)
<ahref=#prependPathclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Prepends <code>dir</code> to $PATH</p><h5id=parameters-11class=heading>Parameters
<ahref=#parameters-11class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=prompt><h4class=heading>hilbish.prompt(str, typ)
<ahref=#promptclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Changes the shell prompt to <code>str</code>
<ahref=#parameters-12class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=read><h4class=heading>hilbish.read(prompt) -> input (string)
<ahref=#readclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Read input from the user, using Hilbish’s line editor/input reader.
This is a separate instance from the one Hilbish actually uses.
Returns <code>input</code>, will be nil if ctrl + d is pressed, or an error occurs (which shouldn’t happen)</p><h5id=parameters-13class=heading>Parameters
<ahref=#parameters-13class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=run><h4class=heading>hilbish.run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string)
<ahref=#runclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Runs <code>cmd</code> in Hilbish’s sh interpreter.
<ahref=#parameters-14class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=runnerMode><h4class=heading>hilbish.runnerMode(mode)
<ahref=#runnerModeclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Sets the execution/runner mode for interactive Hilbish. This determines whether
<ahref=#parameters-15class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=timeout><h4class=heading>hilbish.timeout(cb, time) -> <ahref=/Hilbish/docs/api/hilbish/hilbish.timers/#timerstyle=text-decoration:noneid=lol>Timer</a>
<ahref=#timeoutclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Runs the <code>cb</code> function after <code>time</code> in milliseconds.
<ahref=#parameters-16class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=which><h4class=heading>hilbish.which(name) -> string
<ahref=#whichclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Checks if <code>name</code> is a valid command.
<ahref=#parameters-17class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=luaSinkAutoFlush><hr><divid=luaSinkFlush><hr><divid=luaSinkRead><hr><divid=luaSinkWrite><hr><divid=luaSinkWriteln>## Types
## Sink
A sink is a structure that has input and/or output to/from
<ahref=#autoflushautoclass=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>Sets/toggles the option of automatically flushing output.
A call with no argument will toggle the value.</p><h5id=flushclass=heading>flush()
<ahref=#flushclass=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>Flush writes all buffered input to the sink.</p><h5id=read---stringclass=heading>read() -> string
<ahref=#read---stringclass=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>Reads input from the sink.</p><h5id=writestrclass=heading>write(str)
<ahref=#writestrclass=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>Writes data to a sink.</p><h5id=writelnstrclass=heading>writeln(str)