518 líneas
24 KiB
HTML

<!doctype html>
<html class="bg-stone-50 dark:bg-neutral-950 text-black dark:text-white"><head><meta content="width=device-width, initial-scale=1.0" name="viewport"><link href="/tailwind.css" rel="stylesheet"><title>Hilbish</title><meta content="#ff89dd" name="theme-color"><meta content="./hilbish-flower.png" property="og:image"><meta content="Hilbish" property="og:title"><meta content="Hilbish" property="og:site_name"><meta content="website" property="og:type"><meta content="Something Unique. Hilbish is the new interactive shell for Lua fans. Extensible, scriptable, configurable: All in Lua." property="og:description"><meta content="Something Unique. Hilbish is the new interactive shell for Lua fans. Extensible, scriptable, configurable: All in Lua." name="description"><meta content="Lua,Shell,Hilbish,Linux,zsh,bash" name="keywords"><meta content="https://rosettea.github.io/Hilbish/versions/new-website" property="og:url"></head><body><nav class="flex sticky top-0 w-full z-50 border-b border-b-zinc-300 backdrop-blur-md h-12"><div class="flex my-auto px-2"><div><a class="flex items-center gap-1" href="/"><img class="h-6" src="/hilbish-flower.png"><span class="self-center text-2xl">Hilbish</span></a></div></div></nav><div class="flex flex-col"><div class="block sm:hidden h-10 sticky top-12 flex py-2 px-4 border-b border-b-zinc-300 w-full gap-2 backdrop-blur-sm bg-zinc-300/50 z-50"><label class="cursor-pointer" for="sidebar-toggle"><tag><svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" class="fill-black"><path d="M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"/></svg></tag></label><span>Module hilbish</span></div><div class="grid sm:flex"><input class="peer hidden" id="sidebar-toggle" type="checkbox"><div class="border-r border-r-zinc-300 col-start-1 row-start-1 sticky top-22 sm:top-12 h-full sm:h-svh bg-neutral-200 basis-3/5 transition-transform duration-300 -translate-x-full sm:translate-x-0 peer-checked:translate-x-0 z-30"><div class="p-4 -mb-4 overflow-y-auto h-full"><h2 class="text-xl font-semibold mb-4">Sidebar</h2><ul><li class="mb-2">Lunacolors</li><li class="mb-2">Introduction</li><li class="mb-2">Completions</li><li class="mb-2">Frequently Asked Questions</li><li class="mb-2">Getting Started</li><li class="mb-2">Options</li><li class="mb-2">Features</li><li class="mb-2">Runner Mode</li><li class="mb-2">Notification</li><li class="mb-2">Signals</li><li class="mb-2">Signal</li><li class="mb-2">Command</li><li class="mb-2">Hilbish</li><li class="mb-2">Vim Mode</li><li class="mb-2">Actions</li><li class="mb-2">Module bait</li><li class="mb-2">Module terminal</li><li class="mb-2">API</li><li class="mb-2">Module fs</li><li class="mb-2">Module commander</li><li class="mb-2">Module snail</li><li class="mb-2">Module hilbish.aliases</li><li class="mb-2">Module hilbish.abbr</li><li class="mb-2">Module hilbish</li><li class="mb-2">Module hilbish.userDir</li><li class="mb-2">Module hilbish.messages</li><li class="mb-2">Module hilbish.runner</li><li class="mb-2">Module hilbish.history</li><li class="mb-2">Module hilbish.jobs</li><li class="mb-2">Module hilbish.editor</li><li class="mb-2">Module hilbish.module</li><li class="mb-2">Module hilbish.os</li><li class="mb-2">Module hilbish.completion</li><li class="mb-2">Module hilbish.timers</li><li class="mb-2">Module dirs</li><li class="mb-2">Nature</li><li class="mb-2">Module doc</li></ul></div></div><main class="col-start-1 row-start-1 transition-all duration-300 peer-checked:filter peer-checked:blur-sm peer-checked:bg-black/30 px-4 pt-2"><h1>Module hilbish</h1><Tag xmlns="namespace"><h2>Introduction</h2>
<p>The Hilbish module includes the core API, containing
interfaces and functions which directly relate to shell functionality.</p>
<h2>Functions</h2>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#alias" rel="noopener noreferrer">alias(cmd, orig)</a></td>
<td>Sets an alias, with a name of <code>cmd</code> to another command.</td>
</tr>
<tr>
<td><a href="#appendPath" rel="noopener noreferrer">appendPath(dir)</a></td>
<td>Appends the provided dir to the command path (<code>$PATH</code>)</td>
</tr>
<tr>
<td><a href="#complete" rel="noopener noreferrer">complete(scope, cb)</a></td>
<td>Registers a completion handler for the specified scope.</td>
</tr>
<tr>
<td><a href="#cwd" rel="noopener noreferrer">cwd() -&gt; string</a></td>
<td>Returns the current directory of the shell.</td>
</tr>
<tr>
<td><a href="#exec" rel="noopener noreferrer">exec(cmd)</a></td>
<td>Replaces the currently running Hilbish instance with the supplied command.</td>
</tr>
<tr>
<td><a href="#goro" rel="noopener noreferrer">goro(fn)</a></td>
<td>Puts <code>fn</code> in a Goroutine.</td>
</tr>
<tr>
<td><a href="#highlighter" rel="noopener noreferrer">highlighter(line)</a></td>
<td>Line highlighter handler.</td>
</tr>
<tr>
<td><a href="#hinter" rel="noopener noreferrer">hinter(line, pos)</a></td>
<td>The command line hint handler. It gets called on every key insert to</td>
</tr>
<tr>
<td><a href="#inputMode" rel="noopener noreferrer">inputMode(mode)</a></td>
<td>Sets the input mode for Hilbish’s line reader.</td>
</tr>
<tr>
<td><a href="#interval" rel="noopener noreferrer">interval(cb, time) -&gt; @Timer</a></td>
<td>Runs the <code>cb</code> function every specified amount of <code>time</code>.</td>
</tr>
<tr>
<td><a href="#multiprompt" rel="noopener noreferrer">multiprompt(str)</a></td>
<td>Changes the text prompt when Hilbish asks for more input.</td>
</tr>
<tr>
<td><a href="#prependPath" rel="noopener noreferrer">prependPath(dir)</a></td>
<td>Prepends <code>dir</code> to $PATH.</td>
</tr>
<tr>
<td><a href="#prompt" rel="noopener noreferrer">prompt(str, typ)</a></td>
<td>Changes the shell prompt to the provided string.</td>
</tr>
<tr>
<td><a href="#read" rel="noopener noreferrer">read(prompt) -&gt; input (string)</a></td>
<td>Read input from the user, using Hilbish’s line editor/input reader.</td>
</tr>
<tr>
<td><a href="#timeout" rel="noopener noreferrer">timeout(cb, time) -&gt; @Timer</a></td>
<td>Executed the <code>cb</code> function after a period of <code>time</code>.</td>
</tr>
<tr>
<td><a href="#which" rel="noopener noreferrer">which(name) -&gt; string</a></td>
<td>Checks if <code>name</code> is a valid command.</td>
</tr>
<tr>
<td><a href="#runnerMode" rel="noopener noreferrer">runnerMode(mode)</a></td>
<td>Sets the execution/runner mode for interactive Hilbish.</td>
</tr>
<tr>
<td><a href="#run" rel="noopener noreferrer">run(cmd, streams)</a></td>
<td>Runs <code>cmd</code> in Hilbish’s shell script interpreter.</td>
</tr>
</tbody>
</table>
<h2>Static module fields</h2>
<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>
<div>
<h4>
hilbish.alias(cmd, orig)
<a href="#alias" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Sets an alias, with a name of <code>cmd</code> to another command.</p>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>cmd</code></strong><br>
Name of the alias</p>
<p><code>string</code> <strong><code>orig</code></strong><br>
Command that will be aliased</p>
<h4>Example</h4>
<pre><code><span><span>-- With this, "ga file" will turn into "git add file"</span>
</span><span><span>hilbish</span><span>.</span><span>alias</span><span>(</span><span>'ga'</span><span>,</span> <span>'git add'</span><span>)</span>
</span><span>
</span><span><span>-- Numbered substitutions are supported here!</span>
</span><span><span>hilbish</span><span>.</span><span>alias</span><span>(</span><span>'dircount'</span><span>,</span> <span>'ls %1 | wc -l'</span><span>)</span>
</span><span><span>-- "dircount ~" would count how many files are in ~ (home directory).</span>
</span></code></pre>
</div>
<hr>
<div>
<h4>
hilbish.appendPath(dir)
<a href="#appendPath" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Appends the provided dir to the command path (<code>$PATH</code>)</p>
<h4>Parameters</h4>
<p><code>string|table</code> <strong><code>dir</code></strong><br>
Directory (or directories) to append to path</p>
<h4>Example</h4>
<pre><code><span><span>hilbish</span><span>.</span><span>appendPath</span> <span>'~/go/bin'</span>
</span><span><span>-- Will add ~/go/bin to the command path.</span>
</span><span>
</span><span><span>-- Or do multiple:</span>
</span><span><span>hilbish</span><span>.</span><span>appendPath</span> <span>&lbrace;</span>
</span><span> <span>'~/go/bin'</span><span>,</span>
</span><span> <span>'~/.local/bin'</span>
</span><span><span>&rbrace;</span>
</span></code></pre>
</div>
<hr>
<div>
<h4>
hilbish.complete(scope, cb)
<a href="#complete" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Registers a completion handler for the specified scope.<br>
A <code>scope</code> is expected to be <code>command.&lt;cmd&gt;</code>,<br>
replacing with the name of the command (for example <code>command.git</code>).<br>
The documentation for completions, under Features/Completions or <code>doc completions</code><br>
provides more details.</p>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>scope</code></strong></p>
<p><code>function</code> <strong><code>cb</code></strong></p>
<h4>Example</h4>
<pre><code><span><span>-- This is a very simple example. Read the full doc for completions for details.</span>
</span><span><span>hilbish</span><span>.</span><span>complete</span><span>(</span><span>'command.sudo'</span><span>,</span> <span>function</span><span>(</span><span>query</span><span>,</span> <span>ctx</span><span>,</span> <span>fields</span><span>)</span>
</span><span> <span>if</span> <span>#</span><span>fields</span> <span>==</span> <span>0</span> <span>then</span>
</span><span> <span>-- complete for commands</span>
</span><span> <span>local</span> <span>comps</span><span>,</span> <span>pfx</span> <span>=</span> <span>hilbish</span><span>.</span><span>completion</span><span>.</span><span>bins</span><span>(</span><span>query</span><span>,</span> <span>ctx</span><span>,</span> <span>fields</span><span>)</span>
</span><span> <span>local</span> <span>compGroup</span> <span>=</span> <span>&lbrace;</span>
</span><span> <span>items</span> <span>=</span> <span>comps</span><span>,</span> <span>-- our list of items to complete</span>
</span><span> <span>type</span> <span>=</span> <span>'grid'</span> <span>-- what our completions will look like.</span>
</span><span> <span>&rbrace;</span>
</span><span>
</span><span> <span>return</span> <span>&lbrace;</span><span>compGroup</span><span>&rbrace;</span><span>,</span> <span>pfx</span>
</span><span> <span>end</span>
</span><span>
</span><span> <span>-- otherwise just be boring and return files</span>
</span><span>
</span><span> <span>local</span> <span>comps</span><span>,</span> <span>pfx</span> <span>=</span> <span>hilbish</span><span>.</span><span>completion</span><span>.</span><span>files</span><span>(</span><span>query</span><span>,</span> <span>ctx</span><span>,</span> <span>fields</span><span>)</span>
</span><span> <span>local</span> <span>compGroup</span> <span>=</span> <span>&lbrace;</span>
</span><span> <span>items</span> <span>=</span> <span>comps</span><span>,</span>
</span><span> <span>type</span> <span>=</span> <span>'grid'</span>
</span><span> <span>&rbrace;</span>
</span><span>
</span><span> <span>return</span> <span>&lbrace;</span><span>compGroup</span><span>&rbrace;</span><span>,</span> <span>pfx</span>
</span><span><span>end</span><span>)</span>
</span></code></pre>
</div>
<hr>
<div>
<h4>
hilbish.cwd() -&gt; string
<a href="#cwd" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Returns the current directory of the shell.</p>
<h4>Parameters</h4>
<p>This function has no parameters.</p>
</div>
<hr>
<div>
<h4>
hilbish.exec(cmd)
<a href="#exec" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Replaces the currently running Hilbish instance with the supplied command.<br>
This can be used to do an in-place restart.</p>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>cmd</code></strong></p>
</div>
<hr>
<div>
<h4>
hilbish.goro(fn)
<a href="#goro" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Puts <code>fn</code> in a Goroutine.<br>
This can be used to run any function in another thread at the same time as other Lua code.<br>
<strong>NOTE: THIS FUNCTION MAY CRASH HILBISH IF OUTSIDE VARIABLES ARE ACCESSED.</strong><br>
<strong>This is a limitation of the Lua runtime.</strong></p>
<h4>Parameters</h4>
<p><code>function</code> <strong><code>fn</code></strong></p>
</div>
<hr>
<div>
<h4>
hilbish.highlighter(line)
<a href="#highlighter" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Line highlighter handler.<br>
This is mainly for syntax highlighting, but in reality could set the input<br>
of the prompt to <em>display</em> anything. The callback is passed the current line<br>
and is expected to return a line that will be used as the input display.<br>
Note that to set a highlighter, one has to override this function.</p>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>line</code></strong></p>
<h4>Example</h4>
<pre><code><span><span>--This code will highlight all double quoted strings in green.</span>
</span><span><span>function</span> <span>hilbish</span><span>.</span><span>highlighter</span><span>(</span><span>line</span><span>)</span>
</span><span> <span>return</span> <span>line</span><span>:</span>gsub<span>(</span><span>'<span>"%w+"</span>'</span><span>,</span> <span>function</span><span>(</span><span>c</span><span>)</span> <span>return</span> <span>lunacolors</span><span>.</span><span>green</span><span>(</span><span>c</span><span>)</span> <span>end</span><span>)</span>
</span><span><span>end</span>
</span></code></pre>
</div>
<hr>
<div>
<h4>
hilbish.hinter(line, pos)
<a href="#hinter" rel="noopener noreferrer">
<i></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>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>line</code></strong></p>
<p><code>number</code> <strong><code>pos</code></strong><br>
Position of cursor in line. Usually equals string.len(line)</p>
<h4>Example</h4>
<pre><code><span><span>-- this will display "hi" after the cursor in a dimmed color.</span>
</span><span><span>function</span> <span>hilbish</span><span>.</span><span>hinter</span><span>(</span><span>line</span><span>,</span> <span>pos</span><span>)</span>
</span><span> <span>return</span> <span>'hi'</span>
</span><span><span>end</span>
</span></code></pre>
</div>
<hr>
<div>
<h4>
hilbish.inputMode(mode)
<a href="#inputMode" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Sets the input mode for Hilbish’s line reader.<br>
<code>emacs</code> is the default. Setting it to <code>vim</code> changes behavior of input to be<br>
Vim-like with modes and Vim keybinds.</p>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>mode</code></strong><br>
Can be set to either <code>emacs</code> or <code>vim</code></p>
</div>
<hr>
<div>
<h4>
hilbish.interval(cb, time) -&gt; <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" rel="noopener noreferrer">Timer</a>
<a href="#interval" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Runs the <code>cb</code> function every specified amount of <code>time</code>.<br>
This creates a timer that ticking immediately.</p>
<h4>Parameters</h4>
<p><code>function</code> <strong><code>cb</code></strong></p>
<p><code>number</code> <strong><code>time</code></strong><br>
Time in milliseconds.</p>
</div>
<hr>
<div>
<h4>
hilbish.multiprompt(str)
<a href="#multiprompt" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Changes the text prompt when Hilbish asks for more input.<br>
This will show up when text is incomplete, like a missing quote</p>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>str</code></strong></p>
<h4>Example</h4>
<pre><code><span><span>--[[</span>
</span><span><span>imagine this is your text input:</span>
</span><span><span>user ~ ∆ echo "hey</span>
</span><span><span></span>
</span><span><span>but there's a missing quote! hilbish will now prompt you so the terminal</span>
</span><span><span>will look like:</span>
</span><span><span>user ~ ∆ echo "hey</span>
</span><span><span>--&gt; ...!"</span>
</span><span><span></span>
</span><span><span>so then you get</span>
</span><span><span>user ~ ∆ echo "hey</span>
</span><span><span>--&gt; ...!"</span>
</span><span><span>hey ...!</span>
</span><span><span>]]</span><span>--</span>
</span><span><span>hilbish</span><span>.</span><span>multiprompt</span> <span>'--&gt;'</span>
</span></code></pre>
</div>
<hr>
<div>
<h4>
hilbish.prependPath(dir)
<a href="#prependPath" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Prepends <code>dir</code> to $PATH.</p>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>dir</code></strong></p>
</div>
<hr>
<div>
<h4>
hilbish.prompt(str, typ)
<a href="#prompt" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Changes the shell prompt to the provided string.<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>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>str</code></strong></p>
<p><code>string</code> <strong><code>typ?</code></strong><br>
Type of prompt, being left or right. Left by default.</p>
<h4>Example</h4>
<pre><code><span><span>-- the default hilbish prompt without color</span>
</span><span><span>hilbish</span><span>.</span><span>prompt</span> <span>'%u %d ∆'</span>
</span><span><span>-- or something of old:</span>
</span><span><span>hilbish</span><span>.</span><span>prompt</span> <span>'%u@%h :%d $'</span>
</span><span><span>-- prompt: user@hostname: ~/directory $</span>
</span></code></pre>
</div>
<hr>
<div>
<h4>
hilbish.read(prompt) -&gt; input (string)
<a href="#read" rel="noopener noreferrer">
<i></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.</p>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>prompt?</code></strong><br>
Text to print before input, can be empty.</p>
</div>
<hr>
<div>
<h4>
hilbish.timeout(cb, time) -&gt; <a href="/Hilbish/docs/api/hilbish/hilbish.timers/#timer" rel="noopener noreferrer">Timer</a>
<a href="#timeout" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Executed the <code>cb</code> function after a period of <code>time</code>.<br>
This creates a Timer that starts ticking immediately.</p>
<h4>Parameters</h4>
<p><code>function</code> <strong><code>cb</code></strong></p>
<p><code>number</code> <strong><code>time</code></strong><br>
Time to run in milliseconds.</p>
</div>
<hr>
<div>
<h4>
hilbish.which(name) -&gt; string
<a href="#which" rel="noopener noreferrer">
<i></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>
<h4>Parameters</h4>
<p><code>string</code> <strong><code>name</code></strong></p>
</div>
<h2>Types</h2>
<hr>
<h2>Sink</h2>
<p>A sink is a structure that has input and/or output to/from a desination.</p>
<h3>Methods</h3>
<h4>autoFlush(auto)</h4>
<p>Sets/toggles the option of automatically flushing output.
A call with no argument will toggle the value.</p>
<h4>flush()</h4>
<p>Flush writes all buffered input to the sink.</p>
<h4>read() -&gt; string</h4>
<p>Reads a liine of input from the sink.</p>
<h4>readAll() -&gt; string</h4>
<p>Reads all input from the sink.</p>
<h4>write(str)</h4>
<p>Writes data to a sink.</p>
<h4>writeln(str)</h4>
<p>Writes data to a sink with a newline at the end.</p>
<hr>
<div>
<h4>
hilbish.run(cmd, streams)
<a href="#run" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Runs <code>cmd</code> in Hilbish’s shell script interpreter.
The <code>streams</code> parameter specifies the output and input streams the command should use.
For example, to write command output to a sink.
As a table, the caller can directly specify the standard output, error, and input
streams of the command with the table keys <code>out</code>, <code>err</code>, and <code>input</code> respectively.
As a boolean, it specifies whether the command should use standard output or return its output streams.</p>
<h4>Parameters</h4>
<p><code>cmd</code> <strong><code>string</code></strong></p>
<p><code>streams</code> <strong><code>table|boolean</code></strong></p>
<h4>Example</h4>
<pre><code><span><span>-- This code is the same as `ls -l | wc -l`</span>
</span><span><span>local</span> <span>fs</span> <span>=</span> <span>require</span> <span>'fs'</span>
</span><span><span>local</span> <span>pr</span><span>,</span> <span>pw</span> <span>=</span> <span>fs</span><span>.</span><span>pipe</span><span>(</span><span>)</span>
</span><span><span>hilbish</span><span>.</span><span>run</span><span>(</span><span>'ls -l'</span><span>,</span> <span>&lbrace;</span>
</span><span> <span>stdout</span> <span>=</span> <span>pw</span><span>,</span>
</span><span> <span>stderr</span> <span>=</span> <span>pw</span><span>,</span>
</span><span><span>&rbrace;</span><span>)</span>
</span><span><span>pw</span><span>:</span><span>close</span><span>(</span><span>)</span>
</span><span><span>hilbish</span><span>.</span><span>run</span><span>(</span><span>'wc -l'</span><span>,</span> <span>&lbrace;</span>
</span><span> <span>stdin</span> <span>=</span> <span>pr</span>
</span><span><span>&rbrace;</span><span>)</span>
</span></code></pre>
</div>
<hr>
<div>
<h4>
hilbish.runnerMode(mode)
<a href="#runnerMode" rel="noopener noreferrer">
<i></i>
</a>
</h4>
<p>Sets the execution/runner mode for interactive Hilbish.
<strong>NOTE: This function is deprecated and will be removed in 3.0</strong>
Use <code>hilbish.runner.setCurrent</code> instead.
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.
Read <a href="../features/runner-mode" rel="noopener noreferrer">about runner mode</a> for more information.</p>
<h4>Parameters</h4>
<p><code>mode</code> <strong><code>string|function</code></strong></p>
</div></Tag></main></div></div><footer class="py-4 px-6 flex flex-row justify-around border-t border-t-zinc-300"><div class="flex flex-col"><a class="flex items-center gap-1" href="/"><img class="h-24" src="/hilbish-flower.png"><span class="self-center text-6xl">Hilbish</span></a><span class="text-xl">The Moon-powered shell!</span><span class="text-light text-neutral-500">MIT License, copyright sammyette 2025</span></div><div class="flex flex-col"><a href="https://github.com/Rosettea/Hilbish"><span class="text-pink-300 text-light">GitHub</span></a></div></footer></body></html>