mirror of
https://github.com/Hilbis/Hilbish
synced 2025-07-01 08:42:04 +00:00
308 lines
29 KiB
HTML
308 lines
29 KiB
HTML
<!doctype html>
|
|
<html class="bg-stone-50 dark:bg-neutral-900 text-black dark:text-white"><head><meta content="width=device-width, initial-scale=1.0" name="viewport"><link href="https://rosettea.github.io/Hilbish/versions/new-website/tailwind.css" rel="stylesheet"><title>Hilbish</title><meta content="#ff89dd" name="theme-color"><meta content="https://rosettea.github.io/Hilbish/versions/new-website/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 class="h-screen flex flex-col"><nav class="bg-stone-100/80 dark:bg-neutral-950/80 flex justify-around sticky items-center 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-8" src="https://rosettea.github.io/Hilbish/versions/new-website/hilbish-flower.png"><span class="self-center text-3xl font-medium">Hilbish</span></a></div></div><div class="flex gap-3"><a href="https://rosettea.github.io/Hilbish/versions/new-website/install"><span class="inline-flex text-light dark:text-pink-300 dark:hover:text-pink-200 text-pink-600 hover:text-pink-500 hover:underline">Install</span></a><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs"><span class="inline-flex text-light dark:text-pink-300 dark:hover:text-pink-200 text-pink-600 hover:text-pink-500 hover:underline">Docs</span></a><a href="https://rosettea.github.io/Hilbish/versions/new-website/blog"><span class="inline-flex text-light dark:text-pink-300 dark:hover:text-pink-200 text-pink-600 hover:text-pink-500 hover:underline">Blog</span></a></div></nav><div class="flex-1 flex flex-col overflow-hidden"><div class="sm:hidden h-10 flex py-2 px-4 border-b border-b-zinc-300 w-full gap-2 backdrop-blur-sm bg-zinc-300/50 dark:bg-zinc-800/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-white"><path d="M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"/></svg></tag></label><span class="font-bold">Module hilbish</span></div><div class="flex-1 sm:flex grid overflow-hidden"><input class="peer hidden" id="sidebar-toggle" type="checkbox"><div class="overflow-y-scroll p-4 sm:border-r sm:border-r-zinc-300 col-start-1 row-start-1 bg-neutral-100 dark:bg-neutral-950 basis-2/10 transition-transform duration-300 -translate-x-full peer-checked:translate-x-0 sm:translate-x-0 z-30"><ul class="text-lg flex flex-col gap-2"><li class="font-bold"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs">Introduction</a></li><li class="font-bold"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/getting-started">Getting Started</a></li><li class="font-bold"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/faq">Frequently Asked Questions</a></li><li class="font-bold"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/features">Features</a></li><ul class="pl-4"><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/completions">Completions</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/features/notifications">Notification</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/features/opts">Options</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/features/runner-mode">Runner Mode</a></li></ul><li class="font-bold"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/hooks">Signals</a></li><ul class="pl-4"><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/hooks/command">Command</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/hooks/hilbish">Hilbish</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/hooks/signal">Signal</a></li></ul><li class="font-bold"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/lunacolors">Lunacolors</a></li><li class="font-bold"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/api">API</a></li><ul class="pl-4"><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/api/bait">Module bait</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/api/commander">Module commander</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/api/fs">Module fs</a></li><li class="mb-2 text-pink-400"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/api/hilbish"> -> Module hilbish</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/api/readline">Module readline</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/api/snail">Module snail</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/api/terminal">Module terminal</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/api/yarn">Module yarn</a></li></ul><li class="font-bold"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/nature">Nature</a></li><ul class="pl-4"><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/nature/dirs">Module dirs</a></li><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/nature/doc">Module doc</a></li></ul><li class="font-bold"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/vim-mode">Vim Mode</a></li><ul class="pl-4"><li class="mb-2"><a href="https://rosettea.github.io/Hilbish/versions/new-website/docs/vim-mode/actions">Actions</a></li></ul></ul></div><main class="flex-1 flex justify-center basis-7/7 col-start-1 row-start-1 transition-all duration-300 peer-checked:filter peer-checked:blur-sm peer-checked:bg-black/30"><div class="flex-1 flex flex-col overflow-y-auto"><div class="flex-1 w-3/4 self-center p-8"><h1 class="my-3 font-bold text-4xl">Module hilbish</h1><i></i><h2 class="my-2 text-neutral-800 dark:text-neutral-300 font-bold text-3xl" id="Introduction">Introduction</h2><h2 class="my-2 text-neutral-800 dark:text-neutral-300 font-bold text-3xl" id="Functions">Functions</h2><div><div class='relative overflow-x-auto sm:rounded-lg my-4'>
|
|
<table class='w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400'>
|
|
<tbody>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#alias">alias(cmd, orig)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Sets an alias, with a name of `cmd` to another command.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#appendPath">appendPath(dir)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Appends the provided dir to the command path (`$PATH`)</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#complete">complete(scope, cb)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Registers a completion handler for the specified scope.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#cwd">cwd() -> string</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Returns the current directory of the shell.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#exec">exec(cmd)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Replaces the currently running Hilbish instance with the supplied command.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#goro">goro(fn)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Puts `fn` in a Goroutine.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#highlighter">highlighter(line)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Line highlighter handler.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#hinter">hinter(line, pos)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>The command line hint handler. It gets called on every key insert to</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#inputMode">inputMode(mode)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Sets the input mode for Hilbish's line reader.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#interval">interval(cb, time) -> @Timer</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Runs the `cb` function every specified amount of `time`.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#multiprompt">multiprompt(str)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Changes the text prompt when Hilbish asks for more input.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#prependPath">prependPath(dir)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Prepends `dir` to $PATH.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#prompt">prompt(str, typ)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Changes the shell prompt to the provided string.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#read">read(prompt) -> input (string)</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Read input from the user, using Hilbish's line editor/input reader.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#timeout">timeout(cb, time) -> @Timer</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Executed the `cb` function after a period of `time`.</td>
|
|
</tr>
|
|
<tr class='bg-white border-b dark:bg-neutral-800 dark:border-neutral-700 border-neutral-200'>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'><a href="#which">which(name) -> string</a></td>
|
|
<td class='p-3 font-medium text-black whitespace-nowrap dark:text-white'>Checks if `name` is a valid command.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div></div><h2 class="my-2 text-neutral-800 dark:text-neutral-300 font-bold text-3xl">Functions</h2><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='alias'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.alias(cmd, orig)
|
|
<a href="#alias" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Sets an alias, with a name of <code class="text-violet-600 dark:text-violet-400">cmd</code> to another command. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl" id="Parameters">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>cmd</em>
|
|
Name of the alias</p><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>orig</em>
|
|
Command that will be aliased</p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl" id="Example">Example</h4><pre><code data-lang="lua">-- With this, "ga file" will turn into "git add file"
|
|
hilbish.alias('ga', 'git add')
|
|
|
|
-- Numbered substitutions are supported here!
|
|
hilbish.alias('dircount', 'ls %1 | wc -l')
|
|
-- "dircount ~" would count how many files are in ~ (home directory).
|
|
</code></pre><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='appendPath'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.appendPath(dir)
|
|
<a href="#appendPath" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Appends the provided dir to the command path (<code class="text-violet-600 dark:text-violet-400">$PATH</code>) </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string|table</code> <em>dir</em>
|
|
Directory (or directories) to append to path</p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Example</h4><pre><code data-lang="lua">hilbish.appendPath '~/go/bin'
|
|
-- Will add ~/go/bin to the command path.
|
|
|
|
-- Or do multiple:
|
|
hilbish.appendPath {
|
|
'~/go/bin',
|
|
'~/.local/bin'
|
|
}
|
|
</code></pre><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='complete'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.complete(scope, cb)
|
|
<a href="#complete" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Registers a completion handler for the specified scope.
|
|
A <code class="text-violet-600 dark:text-violet-400">scope</code> is expected to be <code class="text-violet-600 dark:text-violet-400">command.<cmd></code>,
|
|
replacing <cmd> with the name of the command (for example <code class="text-violet-600 dark:text-violet-400">command.git</code>).
|
|
The documentation for completions, under Features/Completions or <code class="text-violet-600 dark:text-violet-400">doc completions</code>
|
|
provides more details. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>scope</em> </p><p><code class="text-violet-600 dark:text-violet-400">function</code> <em>cb</em> </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Example</h4><pre><code data-lang="lua">-- This is a very simple example. Read the full doc for completions for details.
|
|
hilbish.complete('command.sudo', function(query, ctx, fields)
|
|
if #fields == 0 then
|
|
-- complete for commands
|
|
local comps, pfx = hilbish.completion.bins(query, ctx, fields)
|
|
local compGroup = {
|
|
items = comps, -- our list of items to complete
|
|
type = 'grid' -- what our completions will look like.
|
|
}
|
|
|
|
return {compGroup}, pfx
|
|
end
|
|
|
|
-- otherwise just be boring and return files
|
|
|
|
local comps, pfx = hilbish.completion.files(query, ctx, fields)
|
|
local compGroup = {
|
|
items = comps,
|
|
type = 'grid'
|
|
}
|
|
|
|
return {compGroup}, pfx
|
|
end)
|
|
</code></pre><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='cwd'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.cwd() -> string
|
|
<a href="#cwd" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Returns the current directory of the shell. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p>This function has no parameters. </p><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='exec'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.exec(cmd)
|
|
<a href="#exec" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Replaces the currently running Hilbish instance with the supplied command.
|
|
This can be used to do an in-place restart. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>cmd</em> </p><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='goro'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.goro(fn)
|
|
<a href="#goro" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Puts <code class="text-violet-600 dark:text-violet-400">fn</code> in a Goroutine.
|
|
This can be used to run any function in another thread at the same time as other Lua code.
|
|
*<strong>NOTE: THIS FUNCTION MAY CRASH HILBISH IF OUTSIDE VARIABLES ARE ACCESSED.</strong>*
|
|
*<strong>This is a limitation of the Lua runtime.</strong>* </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">function</code> <em>fn</em> </p><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='highlighter'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.highlighter(line)
|
|
<a href="#highlighter" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Line highlighter handler.
|
|
This is mainly for syntax highlighting, but in reality could set the input
|
|
of the prompt to <strong>display</strong> anything. The callback is passed the current line
|
|
and is expected to return a line that will be used as the input display.
|
|
Note that to set a highlighter, one has to override this function. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>line</em> </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Example</h4><pre><code data-lang="lua">--This code will highlight all double quoted strings in green.
|
|
function hilbish.highlighter(line)
|
|
|
|
return line:gsub('"%w+"', function(c) return lunacolors.green(c) end)
|
|
|
|
end
|
|
</code></pre><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='hinter'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.hinter(line, pos)
|
|
<a href="#hinter" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><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><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>line</em> </p><p><code class="text-violet-600 dark:text-violet-400">number</code> <em>pos</em>
|
|
Position of cursor in line. Usually equals string.len(line)</p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Example</h4><pre><code data-lang="lua">-- this will display "hi" after the cursor in a dimmed color.
|
|
function hilbish.hinter(line, pos)
|
|
return 'hi'
|
|
end
|
|
</code></pre><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='inputMode'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.inputMode(mode)
|
|
<a href="#inputMode" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Sets the input mode for Hilbish's line reader.
|
|
<code class="text-violet-600 dark:text-violet-400">emacs</code> is the default. Setting it to <code class="text-violet-600 dark:text-violet-400">vim</code> changes behavior of input to be
|
|
Vim-like with modes and Vim keybinds. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>mode</em>
|
|
Can be set to either <code class="text-violet-600 dark:text-violet-400">emacs</code> or <code class="text-violet-600 dark:text-violet-400">vim</code></p><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='interval'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.interval(cb, time) -> @Timer
|
|
<a href="#interval" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Runs the <code class="text-violet-600 dark:text-violet-400">cb</code> function every specified amount of <code class="text-violet-600 dark:text-violet-400">time</code>.
|
|
This creates a timer that ticking immediately. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">function</code> <em>cb</em> </p><p><code class="text-violet-600 dark:text-violet-400">number</code> <em>time</em>
|
|
Time in milliseconds.</p><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='multiprompt'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.multiprompt(str)
|
|
<a href="#multiprompt" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Changes the text prompt when Hilbish asks for more input.
|
|
This will show up when text is incomplete, like a missing quote </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>str</em> </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Example</h4><pre><code data-lang="lua">--[[
|
|
imagine this is your text input:
|
|
user ~ ∆ echo "hey
|
|
|
|
but there's a missing quote! hilbish will now prompt you so the terminal
|
|
will look like:
|
|
user ~ ∆ echo "hey
|
|
--> ...!"
|
|
|
|
so then you get
|
|
user ~ ∆ echo "hey
|
|
--> ...!"
|
|
hey ...!
|
|
]]--
|
|
hilbish.multiprompt '-->'
|
|
</code></pre><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='prependPath'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.prependPath(dir)
|
|
<a href="#prependPath" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Prepends <code class="text-violet-600 dark:text-violet-400">dir</code> to $PATH. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>dir</em> </p><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='prompt'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.prompt(str, typ)
|
|
<a href="#prompt" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Changes the shell prompt to the provided string.
|
|
There are a few verbs that can be used in the prompt text.
|
|
These will be formatted and replaced with the appropriate values.
|
|
<code class="text-violet-600 dark:text-violet-400">%d</code> - Current working directory
|
|
<code class="text-violet-600 dark:text-violet-400">%u</code> - Name of current user
|
|
<code class="text-violet-600 dark:text-violet-400">%h</code> - Hostname of device </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>str</em> </p><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>typ?</em>
|
|
Type of prompt, being left or right. Left by default.</p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Example</h4><pre><code data-lang="lua">-- the default hilbish prompt without color
|
|
hilbish.prompt '%u %d ∆'
|
|
-- or something of old:
|
|
hilbish.prompt '%u@%h :%d $'
|
|
-- prompt: user@hostname: ~/directory $
|
|
</code></pre><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='read'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.read(prompt) -> input (string)
|
|
<a href="#read" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><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 class="text-violet-600 dark:text-violet-400">input</code>, will be nil if Ctrl-D is pressed, or an error occurs. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>prompt?</em>
|
|
Text to print before input, can be empty.</p><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='timeout'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.timeout(cb, time) -> @Timer
|
|
<a href="#timeout" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Executed the <code class="text-violet-600 dark:text-violet-400">cb</code> function after a period of <code class="text-violet-600 dark:text-violet-400">time</code>.
|
|
This creates a Timer that starts ticking immediately. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">function</code> <em>cb</em> </p><p><code class="text-violet-600 dark:text-violet-400">number</code> <em>time</em>
|
|
Time to run in milliseconds.</p><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'>
|
|
<div id='which'>
|
|
<h4 class='text-xl font-medium mb-2'>
|
|
hilbish.which(name) -> string
|
|
<a href="#which" class='heading-link'>
|
|
<i class="fas fa-paperclip"></i>
|
|
</a>
|
|
</h4>
|
|
</div></div><p>Checks if <code class="text-violet-600 dark:text-violet-400">name</code> is a valid command.
|
|
Will return the path of the binary, or a basename if it's a commander. </p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl">Parameters</h4><p><code class="text-violet-600 dark:text-violet-400">string</code> <em>name</em> </p><h2 class="my-2 text-neutral-800 dark:text-neutral-300 font-bold text-3xl" id="Types">Types</h2><div><hr class='my-4 text-neutral-400 dark:text-neutral-600'></div><h2 class="my-2 text-neutral-800 dark:text-neutral-300 font-bold text-3xl" id="Sink">Sink</h2><p>A sink is a structure that has input and/or output to/from a desination.</p><h3 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-2xl" id="Methods">Methods</h3><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl" id="autoFlush(auto)">autoFlush(auto)</h4><p>Sets/toggles the option of automatically flushing output.
|
|
A call with no argument will toggle the value.</p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl" id="flush()">flush()</h4><p>Flush writes all buffered input to the sink.</p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl" id="read()-->-string">read() -> string</h4><p>Reads a liine of input from the sink.</p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl" id="readAll()-->-string">readAll() -> string</h4><p>Reads all input from the sink.</p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl" id="write(str)">write(str)</h4><p>Writes data to a sink.</p><h4 class="my-1 text-neutral-800 dark:text-neutral-300 font-bold text-xl" id="writeln(str)">writeln(str)</h4><p>Writes data to a sink with a newline at the end.</p></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="https://rosettea.github.io/Hilbish/versions/new-website"><img class="h-24" src="https://rosettea.github.io/Hilbish/versions/new-website/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" target="_blank"><span class="inline-flex text-light dark:text-pink-300 dark:hover:text-pink-200 text-pink-600 hover:text-pink-500 hover:underline"><tag><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25" />
|
|
</svg>
|
|
</tag>GitHub</span></a></div></footer></div></main></div></div></body></html> |