<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=static-module-fieldsclass=heading>Static module fields
<ahref=#static-module-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>Exit code of the last executed command</td></tr></tbody></table><hr><divid=alias><h4class=heading>hilbish.alias(cmd, orig)
<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>.<br>A <code>scope</code> is currently only expected to be <code>command.<cmd></code>,<br>replacing <cmd>with the name of the command (for example <code>command.git</code>).<br><code>cb</code> must be a function that returns a table of “completion groups.”<br>Check <code>doc completions</code> for more information.</p><h5id=parameters-2class=heading>Parameters
<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<br>reality could set the input of the prompt to <em>display</em> anything. The<br>callback is passed the current line and is expected to return a line that<br>will be used as the input display.<br>Note that to set a highlighter, one has to override this function.<br>Example:</p><divclass=highlight><pretabindex=0class=chroma><codeclass=language-fallbackdata-lang=fallback><spanclass=line><spanclass=ln>1</span><spanclass=cl>function hilbish.highlighter(line)
<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<br>determine what text to use as an inline hint. It is passed the current<br>line and cursor position. It is expected to return a string which is used<br>as the text for the hint. This is by default a shim. To set hints,<br>override this function with your custom handler.</p><h5id=parameters-7class=heading>Parameters
<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.<br>This creates a timer that starts immediately.</p><h5id=parameters-9class=heading>Parameters
<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><br>There are a few verbs that can be used in the prompt text.<br>These will be formatted and replaced with the appropriate values.<br><code>%d</code> - Current working directory<br><code>%u</code> - Name of current user<br><code>%h</code> - Hostname of device</p><h5id=parameters-12class=heading>Parameters
<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.<br>This is a separate instance from the one Hilbish actually uses.<br>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.<br>If returnOut is true, the outputs of <code>cmd</code> will be returned as the 2nd and<br>3rd values instead of being outputted to the terminal.</p><h5id=parameters-14class=heading>Parameters
<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<br>Hilbish wll try to run input as Lua and/or sh or only do one of either.<br>Accepted values for mode are hybrid (the default), hybridRev (sh first then Lua),<br>sh, and lua. It also accepts a function, to which if it is passed one<br>will call it to execute user input instead.</p><h5id=parameters-15class=heading>Parameters
<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.<br>This creates a timer that starts immediately.</p><h5id=parameters-16class=heading>Parameters
<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.<br>Will return the path of the binary, or a basename if it’s a commander.</p><h5id=parameters-17class=heading>Parameters
<ahref=#parameters-17class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><h3id=typesclass=heading>Types
<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 a liine of input from the sink.</p><h5id=readall---stringclass=heading>readAll() -> string
<ahref=#readall---stringclass=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>Reads all input from the sink.</p><h5id=writestrclass=heading>write(str)