gh-pages
TorchedSammy 2023-12-02 12:24:04 +00:00
parent cdafa41a8e
commit 804e303bb8
14 changed files with 99 additions and 122 deletions

View File

@ -27,9 +27,7 @@ this function will set the user prompt.</p><h3 id=functions class=heading>Functi
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>name</code></strong><br>The name of the event</p><p><code>function</code> <strong><code>cb</code></strong><br>The function that will be called when the event is thrown.</p></div><hr><div id=hooks><h4 class=heading>bait.hooks(name) -> table
<a href=#hooks class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns a list of callbacks that are hooked on an event with the corresponding <code>name</code>.</p><h5 id=parameters-2 class=heading>Parameters
<a href=#parameters-2 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>name</code></strong><br>The name of the function</p></div><hr><div id=release><h4 class=heading>bait.release(name, catcher)
<a href=#release class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Removes the <code>catcher</code> for the event with <code>name</code>.
For this to work, <code>catcher</code> has to be the same function used to catch
an event, like one saved to a variable.</p><h5 id=parameters-3 class=heading>Parameters
<a href=#release class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Removes the <code>catcher</code> for the event with <code>name</code>.<br>For this to work, <code>catcher</code> has to be the same function used to catch<br>an event, like one saved to a variable.</p><h5 id=parameters-3 class=heading>Parameters
<a href=#parameters-3 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>name</code></strong><br>Name of the event the hook is on</p><p><code>function</code> <strong><code>catcher</code></strong><br>Hook function to remove</p><h5 id=example-1 class=heading>Example
<a href=#example-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><div class=highlight><pre tabindex=0 class=chroma><code class=language-lua data-lang=lua><span class=line><span class=ln>1</span><span class=cl><span class=kd>local</span> <span class=n>hookCallback</span> <span class=o>=</span> <span class=kr>function</span><span class=p>()</span> <span class=n>print</span> <span class=s1>&#39;hi&#39;</span> <span class=kr>end</span>
</span></span><span class=line><span class=ln>2</span><span class=cl>

View File

@ -20,8 +20,7 @@ This sink is for writing errors, as the name would suggest.</li></ul><h3 id=func
<a href=#functions class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=#deregister>deregister(name)</a></td><td>Removes the named command. Note that this will only remove Commander-registered commands.</td></tr><tr><td><a href=#register>register(name, cb)</a></td><td>Adds a new command with the given <code>name</code>. When Hilbish has to run a command with a name,</td></tr></tbody></table><hr><div id=deregister><h4 class=heading>commander.deregister(name)
<a href=#deregister class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Removes the named command. Note that this will only remove Commander-registered commands.</p><h5 id=parameters class=heading>Parameters
<a href=#parameters class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>name</code></strong><br>Name of the command to remove.</p></div><hr><div id=register><h4 class=heading>commander.register(name, cb)
<a href=#register class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Adds a new command with the given <code>name</code>. When Hilbish has to run a command with a name,
it will run the function providing the arguments and sinks.</p><h5 id=parameters-1 class=heading>Parameters
<a href=#register class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Adds a new command with the given <code>name</code>. When Hilbish has to run a command with a name,<br>it will run the function providing the arguments and sinks.</p><h5 id=parameters-1 class=heading>Parameters
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>name</code></strong><br>Name of the command</p><p><code>function</code> <strong><code>cb</code></strong><br>Callback to handle command invocation</p><h5 id=example class=heading>Example
<a href=#example class=heading-link><i class="fas fa-paperclip"></i></a></h5><div class=highlight><pre tabindex=0 class=chroma><code class=language-lua data-lang=lua><span class=line><span class=ln>1</span><span class=cl><span class=c1>-- When you run the command `hello` in the shell, it will print `Hello world`.</span>
</span></span><span class=line><span class=ln>2</span><span class=cl><span class=c1>-- If you run it with, for example, `hello Hilbish`, it will print &#39;Hello Hilbish&#39;</span>

View File

@ -2,34 +2,56 @@
<meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name=theme-color content="#ff89dd"><meta content="/Hilbish/hilbish-flower.png" property="og:image"><meta property="og:site_name" content="Hilbish"><meta content="Module fs — Hilbish" property="og:title"><meta content="filesystem interaction and functionality library" property="og:description"><meta content="filesystem interaction and functionality library" name=description><meta name=revisit-after content="2 days"><meta name=keywords content="Lua,Hilbish,Linux,Shell"><meta property="og:locale" content="en_GB"><link rel=canonical href=https://rosettea.github.io/Hilbish/><meta property="og:url" content="https://rosettea.github.io/Hilbish/"><link href=https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css rel=stylesheet integrity=sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor crossorigin=anonymous><script src=https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js integrity=sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2 crossorigin=anonymous></script><link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin=anonymous referrerpolicy=no-referrer><link rel=stylesheet href=/Hilbish/versions/doc-improvements/css/syntax.min.eb77978873f3b324603120b558a36c98ad57d6ee7b77928e3bc131bd76c5935a.css integrity="sha256-63eXiHPzsyRgMSC1WKNsmK1X1u57d5KOO8ExvXbFk1o="></link><style>.heading>.heading-link{opacity:0}.heading:hover>.heading-link{visibility:visible;opacity:1;transition:all .1s ease-in}@keyframes highlight{0%{background:0 0}50%{background:#fff2cf}100%{background:0 0}}div:target{animation:highlight 1.2s;animation-timing-function:cubic-bezier(1,-.02,.45,.89)}table{border-width:1px;border-style:solid;border-color:#565c64;border-collapse:collapse;margin-bottom:12px}table td{padding:5px}table tr{border-width:1px}thead{display:none}</style></head><body class="d-flex flex-column min-vh-100" style=overflow-x:hidden><svg xmlns="http://www.w3.org/2000/svg" style="display:none"><symbol id="check-circle-fill" fill="currentcolor" viewBox="0 0 16 16"><path d="M16 8A8 8 0 110 8a8 8 0 0116 0zm-3.97-3.03a.75.75.0 00-1.08.022L7.477 9.417 5.384 7.323a.75.75.0 00-1.06 1.06L6.97 11.03a.75.75.0 001.079-.02l3.992-4.99a.75.75.0 00-.01-1.05z"/></symbol><symbol id="info-fill" fill="currentcolor" viewBox="0 0 16 16"><path d="M8 16A8 8 0 108 0a8 8 0 000 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194.0.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703.0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 110-2 1 1 0 010 2z"/></symbol><symbol id="exclamation-triangle-fill" fill="currentcolor" viewBox="0 0 16 16"><path d="M8.982 1.566a1.13 1.13.0 00-1.96.0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889.0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535.0.954.462.9.995l-.35 3.507a.552.552.0 01-1.1.0L7.1 5.995A.905.905.0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"/></symbol></svg><header><nav class="navbar navbar-expand-md sticky-top bg-light border-bottom"><div class=container-fluid><a class=navbar-brand href=/Hilbish><img src=/Hilbish/hilbish-logo-and-text.png alt height=48>
</a><button class=navbar-toggler type=button data-bs-toggle=collapse data-bs-target=#navbarSupportedContent aria-controls=navbarSupportedContent aria-expanded=false aria-label="Toggle navigation">
<span class=navbar-toggler-icon></span></button><div class="collapse navbar-collapse" id=navbarSupportedContent><ul class="navbar-nav me-auto mb-2 mb-lg-0"><li class=nav-item><a href=/Hilbish/versions/doc-improvements/ class=nav-link>Home</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/install/ class=nav-link>Install</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/ class=nav-link>Docs</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/blog/ class=nav-link>Blog</a></li></ul></div></div></nav></header><style>@media(min-width:768px){.sidenav{width:240px}}</style><div class=row><nav class="navbar-expand-md bg-light sidenav border-end"><div class=container><div class="collapse navbar-collapse" id=navbarSupportedContent><nav class="navbar navbar-expand-md bg-light sidenav col" style=margin-top:-20px><ul class="navbar-nav me-auto mb-2 mb-lg-0 flex-column col mt-4"><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/ class=nav-link><strong>Introduction</strong></a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/getting-started/ class=nav-link><strong>Getting Started</strong></a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/faq/ class=nav-link><strong>Frequently Asked Questions</strong></a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/features/ class=nav-link><strong>Features</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/features/notifications/ class=nav-link>Notification</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/features/runner-mode/ class=nav-link>Runner Mode</a></li></ul><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/hooks/ class=nav-link><strong>Hooks</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/hooks/command/ class=nav-link>Command</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/hooks/hilbish/ class=nav-link>Hilbish</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/hooks/signal/ class=nav-link>Signal</a></li></ul><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/ class=nav-link><strong>API</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/bait/ class=nav-link>Module bait</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/commander/ class=nav-link>Module commander</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/fs/ class=nav-link>Module fs</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/ class=nav-link>Module hilbish</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/ class=nav-link>Module hilbish.aliases</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.completions/ class=nav-link>Module hilbish.completions</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/ class=nav-link>Module hilbish.editor</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.history/ class=nav-link>Module hilbish.history</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.jobs/ class=nav-link>Module hilbish.jobs</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.module/ class=nav-link>Module hilbish.module</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.os/ class=nav-link>Module hilbish.os</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.runner/ class=nav-link>Module hilbish.runner</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.timers/ class=nav-link>Module hilbish.timers</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.userdir/ class=nav-link>Module hilbish.userDir</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/terminal/ class=nav-link>Module terminal</a></li></ul></ul></nav></div></div></nav><container class="col mt-2" style="padding-left: 20px; padding-right: 20px;"><div><h1>Module fs</h1><p><em>filesystem interaction and functionality library<br></em></p><h3 id=introduction class=heading>Introduction
<a href=#introduction class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>The fs module provides easy and simple access to filesystem functions
and other things, and acts an addition to the Lua standard library&rsquo;s
I/O and filesystem functions.</p><h3 id=functions class=heading>Functions
<a href=#functions class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=#abs>abs(path) -> string</a></td><td>Gives an absolute version of <code>path</code>.</td></tr><tr><td><a href=#basename>basename(path) -> string</a></td><td>Gives the basename of <code>path</code>. For the rules,</td></tr><tr><td><a href=#cd>cd(dir)</a></td><td>Changes directory to <code>dir</code></td></tr><tr><td><a href=#dir>dir(path) -> string</a></td><td>Returns the directory part of <code>path</code>. For the rules, see Go&rsquo;s</td></tr><tr><td><a href=#glob>glob(pattern) -> matches (table)</a></td><td>Glob all files and directories that match the pattern.</td></tr><tr><td><a href=#join>join(&mldr;) -> string</a></td><td>Takes paths and joins them together with the OS&rsquo;s</td></tr><tr><td><a href=#mkdir>mkdir(name, recursive)</a></td><td>Makes a directory called <code>name</code>. If <code>recursive</code> is true, it will create its parent directories.</td></tr><tr><td><a href=#readdir>readdir(dir) -> {}</a></td><td>Returns a table of files in <code>dir</code>.</td></tr><tr><td><a href=#stat>stat(path) -> {}</a></td><td>Returns a table of info about the <code>path</code>.</td></tr></tbody></table><hr><div id=abs><h4 class=heading>fs.abs(path) -> string
<a href=#abs class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Gives an absolute version of <code>path</code>.</p><h5 id=parameters class=heading>Parameters
<a href=#parameters class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=basename><h4 class=heading>fs.basename(path) -> string
<a href=#basename class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Gives the basename of <code>path</code>. For the rules,
see Go&rsquo;s filepath.Base</p><h5 id=parameters-1 class=heading>Parameters
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=cd><h4 class=heading>fs.cd(dir)
<a href=#cd class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Changes directory to <code>dir</code></p><h5 id=parameters-2 class=heading>Parameters
<a href=#parameters-2 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=dir><h4 class=heading>fs.dir(path) -> string
<a href=#dir class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns the directory part of <code>path</code>. For the rules, see Go&rsquo;s
filepath.Dir</p><h5 id=parameters-3 class=heading>Parameters
<a href=#parameters-3 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=glob><h4 class=heading>fs.glob(pattern) -> matches (table)
<a href=#glob class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Glob all files and directories that match the pattern.
For the rules, see Go&rsquo;s filepath.Glob</p><h5 id=parameters-4 class=heading>Parameters
<a href=#parameters-4 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=join><h4 class=heading>fs.join(...) -> string
<a href=#join class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Takes paths and joins them together with the OS&rsquo;s
directory separator (forward or backward slash).</p><h5 id=parameters-5 class=heading>Parameters
<a href=#parameters-5 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=mkdir><h4 class=heading>fs.mkdir(name, recursive)
<a href=#mkdir class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Makes a directory called <code>name</code>. If <code>recursive</code> is true, it will create its parent directories.</p><h5 id=parameters-6 class=heading>Parameters
<a href=#parameters-6 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=readdir><h4 class=heading>fs.readdir(dir) -> {}
<a href=#readdir class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns a table of files in <code>dir</code>.</p><h5 id=parameters-7 class=heading>Parameters
<a href=#parameters-7 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=stat><h4 class=heading>fs.stat(path) -> {}
<a href=#stat class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns a table of info about the <code>path</code>.
It contains the following keys:
name (string) - Name of the path
size (number) - Size of the path
mode (string) - Permission mode in an octal format string (with leading 0)
isDir (boolean) - If the path is a directory</p><h5 id=parameters-8 class=heading>Parameters
<a href=#parameters-8 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div></div><div class="footer mt-auto"><p class="card-small text-muted">Want to help improve this page? <a href=https://github.com/Rosettea/Hilbish/issues/new/choose>Create an issue.</a></p></div></container></div><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea &copy; 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html>
<a href=#introduction class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>The fs module provides filesystem functions to Hilbish. While Lua&rsquo;s standard
library has some I/O functions, they&rsquo;re missing a lot of the basics. The <code>fs</code>
library offers more functions and will work on any operating system Hilbish does.</p><h3 id=functions class=heading>Functions
<a href=#functions class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=#abs>abs(path) -> string</a></td><td>Returns an absolute version of the <code>path</code>.</td></tr><tr><td><a href=#basename>basename(path) -> string</a></td><td>Returns the &ldquo;basename,&rdquo; or the last part of the provided <code>path</code>. If path is empty,</td></tr><tr><td><a href=#cd>cd(dir)</a></td><td>Changes Hilbish&rsquo;s directory to <code>dir</code>.</td></tr><tr><td><a href=#dir>dir(path) -> string</a></td><td>Returns the directory part of <code>path</code>. If a file path like</td></tr><tr><td><a href=#glob>glob(pattern) -> matches (table)</a></td><td>Match all files based on the provided <code>pattern</code>.</td></tr><tr><td><a href=#join>join(&mldr;path) -> string</a></td><td>Takes any list of paths and joins them based on the operating system&rsquo;s path separator.</td></tr><tr><td><a href=#mkdir>mkdir(name, recursive)</a></td><td>Creates a new directory with the provided <code>name</code>.</td></tr><tr><td><a href=#readdir>readdir(path) -> table[string]</a></td><td>Returns a list of all files and directories in the provided path.</td></tr><tr><td><a href=#stat>stat(path) -> {}</a></td><td>Returns the information about a given <code>path</code>.</td></tr></tbody></table><h3 id=static-module-fields class=heading>Static module fields
<a href=#static-module-fields class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>pathSep</td><td>The operating system&rsquo;s path separator.</td></tr></tbody></table><hr><div id=abs><h4 class=heading>fs.abs(path) -> string
<a href=#abs class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns an absolute version of the <code>path</code>.<br>This can be used to resolve short paths like <code>..</code> to <code>/home/user</code>.</p><h5 id=parameters class=heading>Parameters
<a href=#parameters class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>path</code></strong></p></div><hr><div id=basename><h4 class=heading>fs.basename(path) -> string
<a href=#basename class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns the &ldquo;basename,&rdquo; or the last part of the provided <code>path</code>. If path is empty,<br><code>.</code> will be returned.</p><h5 id=parameters-1 class=heading>Parameters
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>path</code></strong><br>Path to get the base name of.</p></div><hr><div id=cd><h4 class=heading>fs.cd(dir)
<a href=#cd class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Changes Hilbish&rsquo;s directory to <code>dir</code>.</p><h5 id=parameters-2 class=heading>Parameters
<a href=#parameters-2 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>dir</code></strong><br>Path to change directory to.</p></div><hr><div id=dir><h4 class=heading>fs.dir(path) -> string
<a href=#dir class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns the directory part of <code>path</code>. If a file path like<br><code>~/Documents/doc.txt</code> then this function will return <code>~/Documents</code>.</p><h5 id=parameters-3 class=heading>Parameters
<a href=#parameters-3 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>path</code></strong><br>Path to get the directory for.</p></div><hr><div id=glob><h4 class=heading>fs.glob(pattern) -> matches (table)
<a href=#glob class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Match all files based on the provided <code>pattern</code>.<br>For the syntax&rsquo; refer to Go&rsquo;s filepath.Match function: <a href=https://pkg.go.dev/path/filepath#Match target=_blank rel=noopener>https://pkg.go.dev/path/filepath#Match</a></p><h5 id=parameters-4 class=heading>Parameters
<a href=#parameters-4 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>pattern</code></strong><br>Pattern to compare files with.</p><h5 id=example class=heading>Example
<a href=#example class=heading-link><i class="fas fa-paperclip"></i></a></h5><div class=highlight><pre tabindex=0 class=chroma><code class=language-lua data-lang=lua><span class=line><span class=ln> 1</span><span class=cl><span class=cm>--[[
</span></span></span><span class=line><span class=ln> 2</span><span class=cl><span class=cm> Within a folder that contains the following files:
</span></span></span><span class=line><span class=ln> 3</span><span class=cl><span class=cm> a.txt
</span></span></span><span class=line><span class=ln> 4</span><span class=cl><span class=cm> init.lua
</span></span></span><span class=line><span class=ln> 5</span><span class=cl><span class=cm> code.lua
</span></span></span><span class=line><span class=ln> 6</span><span class=cl><span class=cm> doc.pdf
</span></span></span><span class=line><span class=ln> 7</span><span class=cl><span class=cm>]]</span><span class=c1>--</span>
</span></span><span class=line><span class=ln> 8</span><span class=cl><span class=kd>local</span> <span class=n>matches</span> <span class=o>=</span> <span class=n>fs.glob</span> <span class=s1>&#39;./*.lua&#39;</span>
</span></span><span class=line><span class=ln> 9</span><span class=cl><span class=n>print</span><span class=p>(</span><span class=n>matches</span><span class=p>)</span>
</span></span><span class=line><span class=ln>10</span><span class=cl><span class=c1>-- -&gt; {&#39;init.lua&#39;, &#39;code.lua&#39;}</span>
</span></span></code></pre></div></div><hr><div id=join><h4 class=heading>fs.join(...path) -> string
<a href=#join class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Takes any list of paths and joins them based on the operating system&rsquo;s path separator.</p><h5 id=parameters-5 class=heading>Parameters
<a href=#parameters-5 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>path</code></strong> (This type is variadic. You can pass an infinite amount of parameters with this type.)<br>Paths to join together</p><h5 id=example-1 class=heading>Example
<a href=#example-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><div class=highlight><pre tabindex=0 class=chroma><code class=language-lua data-lang=lua><span class=line><span class=ln>1</span><span class=cl><span class=c1>-- This prints the directory for Hilbish&#39;s config!</span>
</span></span><span class=line><span class=ln>2</span><span class=cl><span class=n>print</span><span class=p>(</span><span class=n>fs.join</span><span class=p>(</span><span class=n>hilbish.userDir</span><span class=p>.</span><span class=n>config</span><span class=p>,</span> <span class=s1>&#39;hilbish&#39;</span><span class=p>))</span>
</span></span><span class=line><span class=ln>3</span><span class=cl><span class=c1>-- -&gt; &#39;/home/user/.config/hilbish&#39; on Linux</span>
</span></span></code></pre></div></div><hr><div id=mkdir><h4 class=heading>fs.mkdir(name, recursive)
<a href=#mkdir class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Creates a new directory with the provided <code>name</code>.<br>With <code>recursive</code>, mkdir will create parent directories.</p><p>&ndash; This will create the directory foo, then create the directory bar in the<br>&ndash; foo directory. If recursive is false in this case, it will fail.<br>fs.mkdir(&rsquo;./foo/bar&rsquo;, true)</p><h5 id=parameters-6 class=heading>Parameters
<a href=#parameters-6 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>name</code></strong><br>Name of the directory</p><p><code>boolean</code> <strong><code>recursive</code></strong><br>Whether to create parent directories for the provided name</p><h5 id=example-2 class=heading>Example
<a href=#example-2 class=heading-link><i class="fas fa-paperclip"></i></a></h5><div class=highlight><pre tabindex=0 class=chroma><code class=language-lua data-lang=lua></code></pre></div></div><hr><div id=readdir><h4 class=heading>fs.readdir(path) -> table[string]
<a href=#readdir class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns a list of all files and directories in the provided path.</p><h5 id=parameters-7 class=heading>Parameters
<a href=#parameters-7 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>dir</code></strong></p></div><hr><div id=stat><h4 class=heading>fs.stat(path) -> {}
<a href=#stat class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns the information about a given <code>path</code>.<br>The returned table contains the following values:<br>name (string) - Name of the path<br>size (number) - Size of the path in bytes<br>mode (string) - Unix permission mode in an octal format string (with leading 0)<br>isDir (boolean) - If the path is a directory</p><h5 id=parameters-8 class=heading>Parameters
<a href=#parameters-8 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p><code>string</code> <strong><code>path</code></strong></p><h5 id=example-3 class=heading>Example
<a href=#example-3 class=heading-link><i class="fas fa-paperclip"></i></a></h5><div class=highlight><pre tabindex=0 class=chroma><code class=language-lua data-lang=lua><span class=line><span class=ln> 1</span><span class=cl><span class=kd>local</span> <span class=n>inspect</span> <span class=o>=</span> <span class=n>require</span> <span class=s1>&#39;inspect&#39;</span>
</span></span><span class=line><span class=ln> 2</span><span class=cl>
</span></span><span class=line><span class=ln> 3</span><span class=cl><span class=kd>local</span> <span class=n>stat</span> <span class=o>=</span> <span class=n>fs.stat</span> <span class=s1>&#39;~&#39;</span>
</span></span><span class=line><span class=ln> 4</span><span class=cl><span class=n>print</span><span class=p>(</span><span class=n>inspect</span><span class=p>(</span><span class=n>stat</span><span class=p>))</span>
</span></span><span class=line><span class=ln> 5</span><span class=cl><span class=cm>--[[
</span></span></span><span class=line><span class=ln> 6</span><span class=cl><span class=cm>Would print the following:
</span></span></span><span class=line><span class=ln> 7</span><span class=cl><span class=cm>{
</span></span></span><span class=line><span class=ln> 8</span><span class=cl><span class=cm> isDir = true,
</span></span></span><span class=line><span class=ln> 9</span><span class=cl><span class=cm> mode = &#34;0755&#34;,
</span></span></span><span class=line><span class=ln>10</span><span class=cl><span class=cm> name = &#34;username&#34;,
</span></span></span><span class=line><span class=ln>11</span><span class=cl><span class=cm> size = 12288
</span></span></span><span class=line><span class=ln>12</span><span class=cl><span class=cm>}
</span></span></span><span class=line><span class=ln>13</span><span class=cl><span class=cm>]]</span><span class=c1>--</span>
</span></span></code></pre></div></div></div><div class="footer mt-auto"><p class="card-small text-muted">Want to help improve this page? <a href=https://github.com/Rosettea/Hilbish/issues/new/choose>Create an issue.</a></p></div></container></div><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea &copy; 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html>

View File

@ -4,13 +4,9 @@
<span class=navbar-toggler-icon></span></button><div class="collapse navbar-collapse" id=navbarSupportedContent><ul class="navbar-nav me-auto mb-2 mb-lg-0"><li class=nav-item><a href=/Hilbish/versions/doc-improvements/ class=nav-link>Home</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/install/ class=nav-link>Install</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/ class=nav-link>Docs</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/blog/ class=nav-link>Blog</a></li></ul></div></div></nav></header><style>@media(min-width:768px){.sidenav{width:240px}}</style><div class=row><nav class="navbar-expand-md bg-light sidenav border-end"><div class=container><div class="collapse navbar-collapse" id=navbarSupportedContent><nav class="navbar navbar-expand-md bg-light sidenav col" style=margin-top:-20px><ul class="navbar-nav me-auto mb-2 mb-lg-0 flex-column col mt-4"><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/ class=nav-link><strong>Introduction</strong></a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/getting-started/ class=nav-link><strong>Getting Started</strong></a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/faq/ class=nav-link><strong>Frequently Asked Questions</strong></a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/features/ class=nav-link><strong>Features</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/features/notifications/ class=nav-link>Notification</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/features/runner-mode/ class=nav-link>Runner Mode</a></li></ul><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/hooks/ class=nav-link><strong>Hooks</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/hooks/command/ class=nav-link>Command</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/hooks/hilbish/ class=nav-link>Hilbish</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/hooks/signal/ class=nav-link>Signal</a></li></ul><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/ class=nav-link><strong>API</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/bait/ class=nav-link>Module bait</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/commander/ class=nav-link>Module commander</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/fs/ class=nav-link>Module fs</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/ class=nav-link>Module hilbish</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/ class=nav-link>Module hilbish.aliases</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.completions/ class=nav-link>Module hilbish.completions</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/ class=nav-link>Module hilbish.editor</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.history/ class=nav-link>Module hilbish.history</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.jobs/ class=nav-link>Module hilbish.jobs</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.module/ class=nav-link>Module hilbish.module</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.os/ class=nav-link>Module hilbish.os</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.runner/ class=nav-link>Module hilbish.runner</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.timers/ class=nav-link>Module hilbish.timers</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.userdir/ class=nav-link>Module hilbish.userDir</a></li><li class=nav-item><a href=/Hilbish/versions/doc-improvements/docs/api/terminal/ class=nav-link>Module terminal</a></li></ul></ul></nav></div></div></nav><container class="col mt-2" style="padding-left: 20px; padding-right: 20px;"><div><h1>Module hilbish.completions</h1><p><em>tab completions<br></em></p><h3 id=introduction class=heading>Introduction
<a href=#introduction class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>The completions interface deals with tab completions.</p><h3 id=functions class=heading>Functions
<a href=#functions class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=#completions.call>call(name, query, ctx, fields) -> completionGroups (table), prefix (string)</a></td><td>Calls a completer function. This is mainly used to call</td></tr><tr><td><a href=#completions.handler>handler(line, pos)</a></td><td>The handler function is the callback for tab completion in Hilbish.</td></tr><tr><td><a href=#completions.bins>bins(query, ctx, fields) -> entries (table), prefix (string)</a></td><td>Returns binary/executale completion candidates based on the provided query.</td></tr><tr><td><a href=#completions.files>files(query, ctx, fields) -> entries (table), prefix (string)</a></td><td>Returns file completion candidates based on the provided query.</td></tr></tbody></table><hr><div id=completions.call><h4 class=heading>hilbish.completions.call(name, query, ctx, fields) -> completionGroups (table), prefix (string)
<a href=#completions.call class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Calls a completer function. This is mainly used to call
a command completer, which will have a <code>name</code> in the form
of <code>command.name</code>, example: <code>command.git</code>.
You can check <code>doc completions</code> for info on the <code>completionGroups</code> return value.</p><h5 id=parameters class=heading>Parameters
<a href=#completions.call class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Calls a completer function. This is mainly used to call<br>a command completer, which will have a <code>name</code> in the form<br>of <code>command.name</code>, example: <code>command.git</code>.<br>You can check <code>doc completions</code> for info on the <code>completionGroups</code> return value.</p><h5 id=parameters class=heading>Parameters
<a href=#parameters class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=completions.handler><h4 class=heading>hilbish.completions.handler(line, pos)
<a href=#completions.handler class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>The handler function is the callback for tab completion in Hilbish.
You can check the completions doc for more info.</p><h5 id=parameters-1 class=heading>Parameters
<a href=#completions.handler class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>The handler function is the callback for tab completion in Hilbish.<br>You can check the completions doc for more info.</p><h5 id=parameters-1 class=heading>Parameters
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=completions.bins><h4 class=heading>hilbish.completions.bins(query, ctx, fields) -> entries (table), prefix (string)
<a href=#completions.bins class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns binary/executale completion candidates based on the provided query.</p><h5 id=parameters-2 class=heading>Parameters
<a href=#parameters-2 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=completions.files><h4 class=heading>hilbish.completions.files(query, ctx, fields) -> entries (table), prefix (string)

View File

@ -11,8 +11,7 @@ directly interact with the line editor in use.</p><h3 id=functions class=heading
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=editor.insert><h4 class=heading>hilbish.editor.insert(text)
<a href=#editor.insert class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Inserts text into the line.</p><h5 id=parameters-2 class=heading>Parameters
<a href=#parameters-2 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=editor.getChar><h4 class=heading>hilbish.editor.getChar() -> string
<a href=#editor.getChar class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Reads a keystroke from the user. This is in a format
of something like Ctrl-L..</p><h5 id=parameters-3 class=heading>Parameters
<a href=#editor.getChar class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Reads a keystroke from the user. This is in a format<br>of something like Ctrl-L..</p><h5 id=parameters-3 class=heading>Parameters
<a href=#parameters-3 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=editor.setVimRegister><h4 class=heading>hilbish.editor.setVimRegister(register, text)
<a href=#editor.setVimRegister class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Sets the vim register at <code>register</code> to hold the passed text.</p><h5 id=parameters-4 class=heading>Parameters
<a href=#parameters-4 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div></div><div class="footer mt-auto"><p class="card-small text-muted">Want to help improve this page? <a href=https://github.com/Rosettea/Hilbish/issues/new/choose>Create an issue.</a></p></div></container></div><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea &copy; 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html>

View File

@ -24,6 +24,5 @@ it to use it for a native plugin.</p><p>Here is some code for an example plugin:
If you attempt to require and print the result (<code>print(require 'plugin')</code>), it will show &ldquo;hello world!&rdquo;</p><h3 id=functions class=heading>Functions
<a href=#functions class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=#module.load>load(path)</a></td><td>Loads a module at the designated <code>path</code>.</td></tr></tbody></table><h3 id=static-module-fields class=heading>Static module fields
<a href=#static-module-fields class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>paths</td><td>A list of paths to search when loading native modules. This is in the style of Lua search paths and will be used when requiring native modules. Example: <code>?.so;?/?.so</code></td></tr></tbody></table><hr><div id=module.load><h4 class=heading>hilbish.module.load(path)
<a href=#module.load class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Loads a module at the designated <code>path</code>.
It will throw if any error occurs.</p><h5 id=parameters class=heading>Parameters
<a href=#module.load class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Loads a module at the designated <code>path</code>.<br>It will throw if any error occurs.</p><h5 id=parameters class=heading>Parameters
<a href=#parameters class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div></div><div class="footer mt-auto"><p class="card-small text-muted">Want to help improve this page? <a href=https://github.com/Rosettea/Hilbish/issues/new/choose>Create an issue.</a></p></div></container></div><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea &copy; 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html>

View File

@ -8,14 +8,9 @@ Users can add and change the default runner for interactive input to any
language or script of their choosing. A good example is using it to
write command in Fennel.</p><h3 id=functions class=heading>Functions
<a href=#functions class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=#runner.setMode>setMode(cb)</a></td><td>This is the same as the <code>hilbish.runnerMode</code> function. It takes a callback,</td></tr><tr><td><a href=#runner.lua>lua(cmd)</a></td><td>Evaluates <code>cmd</code> as Lua input. This is the same as using <code>dofile</code></td></tr><tr><td><a href=#runner.sh>sh(cmd)</a></td><td>Runs a command in Hilbish&rsquo;s shell script interpreter.</td></tr></tbody></table><hr><div id=runner.setMode><h4 class=heading>hilbish.runner.setMode(cb)
<a href=#runner.setMode class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>This is the same as the <code>hilbish.runnerMode</code> function. It takes a callback,
which will be used to execute all interactive input.
In normal cases, neither callbacks should be overrided by the user,
as the higher level functions listed below this will handle it.</p><h5 id=parameters class=heading>Parameters
<a href=#runner.setMode class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>This is the same as the <code>hilbish.runnerMode</code> function. It takes a callback,<br>which will be used to execute all interactive input.<br>In normal cases, neither callbacks should be overrided by the user,<br>as the higher level functions listed below this will handle it.</p><h5 id=parameters class=heading>Parameters
<a href=#parameters class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=runner.lua><h4 class=heading>hilbish.runner.lua(cmd)
<a href=#runner.lua class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Evaluates <code>cmd</code> as Lua input. This is the same as using <code>dofile</code>
or <code>load</code>, but is appropriated for the runner interface.</p><h5 id=parameters-1 class=heading>Parameters
<a href=#runner.lua class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Evaluates <code>cmd</code> as Lua input. This is the same as using <code>dofile</code><br>or <code>load</code>, but is appropriated for the runner interface.</p><h5 id=parameters-1 class=heading>Parameters
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=runner.sh><h4 class=heading>hilbish.runner.sh(cmd)
<a href=#runner.sh class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Runs a command in Hilbish&rsquo;s shell script interpreter.
This is the equivalent of using <code>source</code>.</p><h5 id=parameters-2 class=heading>Parameters
<a href=#runner.sh class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Runs a command in Hilbish&rsquo;s shell script interpreter.<br>This is the equivalent of using <code>source</code>.</p><h5 id=parameters-2 class=heading>Parameters
<a href=#parameters-2 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div></div><div class="footer mt-auto"><p class="card-small text-muted">Want to help improve this page? <a href=https://github.com/Rosettea/Hilbish/issues/new/choose>Create an issue.</a></p></div></container></div><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea &copy; 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html>

View File

@ -7,17 +7,16 @@ a few seconds, you don&rsquo;t have to rely on timing tricks, as Hilbish has a
timer API to set intervals and timeouts.</p><p>These are the simple functions <code>hilbish.interval</code> and <code>hilbish.timeout</code> (doc
accessible with <code>doc hilbish</code>). But if you want slightly more control over
them, there is the <code>hilbish.timers</code> interface. It allows you to get
a timer via ID and control them.</p><p>All functions documented with the <code>Timer</code> type refer to a Timer object.</p><p>An example of usage:</p><pre tabindex=0><code>local t = hilbish.timers.create(hilbish.timers.TIMEOUT, 5000, function()
print &#39;hello!&#39;
end)
t:start()
print(t.running) // true
</code></pre><h3 id=functions class=heading>Functions
a timer via ID and control them.</p><p>All functions documented with the <code>Timer</code> type refer to a Timer object.</p><p>An example of usage:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=ln>1</span><span class=cl>local t = hilbish.timers.create(hilbish.timers.TIMEOUT, 5000, function()
</span></span><span class=line><span class=ln>2</span><span class=cl> print &#39;hello!&#39;
</span></span><span class=line><span class=ln>3</span><span class=cl>end)
</span></span><span class=line><span class=ln>4</span><span class=cl>
</span></span><span class=line><span class=ln>5</span><span class=cl>t:start()
</span></span><span class=line><span class=ln>6</span><span class=cl>print(t.running) // true
</span></span></code></pre></div><h3 id=functions class=heading>Functions
<a href=#functions class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=#timers.create>create(type, time, callback) -> @Timer</a></td><td>Creates a timer that runs based on the specified <code>time</code> in milliseconds.</td></tr><tr><td><a href=#timers.get>get(id) -> @Timer</a></td><td>Retrieves a timer via its ID.</td></tr></tbody></table><h3 id=static-module-fields class=heading>Static module fields
<a href=#static-module-fields class=heading-link><i class="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>INTERVAL</td><td>Constant for an interval timer type</td></tr><tr><td>TIMEOUT</td><td>Constant for a timeout timer type</td></tr></tbody></table><hr><div id=timers.create><h4 class=heading>hilbish.timers.create(type, time, callback) -> <a href=/Hilbish/docs/api/hilbish/hilbish.timers/#timer style=text-decoration:none id=lol>Timer</a>
<a href=#timers.create class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Creates a timer that runs based on the specified <code>time</code> in milliseconds.
The <code>type</code> can either be <code>hilbish.timers.INTERVAL</code> or <code>hilbish.timers.TIMEOUT</code></p><h5 id=parameters class=heading>Parameters
<a href=#timers.create class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Creates a timer that runs based on the specified <code>time</code> in milliseconds.<br>The <code>type</code> can either be <code>hilbish.timers.INTERVAL</code> or <code>hilbish.timers.TIMEOUT</code></p><h5 id=parameters class=heading>Parameters
<a href=#parameters class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=timers.get><h4 class=heading>hilbish.timers.get(id) -> <a href=/Hilbish/docs/api/hilbish/hilbish.timers/#timer style=text-decoration:none id=lol>Timer</a>
<a href=#timers.get class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Retrieves a timer via its ID.</p><h5 id=parameters-1 class=heading>Parameters
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><h3 id=types class=heading>Types

View File

@ -10,11 +10,7 @@ interfaces and functions which directly relate to shell functionality.</p><h3 id
<a href=#parameters class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=appendPath><h4 class=heading>hilbish.appendPath(dir)
<a href=#appendPath class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Appends <code>dir</code> to $PATH</p><h5 id=parameters-1 class=heading>Parameters
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=complete><h4 class=heading>hilbish.complete(scope, cb)
<a href=#complete class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Registers a completion handler for <code>scope</code>.
A <code>scope</code> is currently only expected to be <code>command.&lt;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 &ldquo;completion groups.&rdquo;
Check <code>doc completions</code> for more information.</p><h5 id=parameters-2 class=heading>Parameters
<a href=#complete class=heading-link><i class="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.&lt;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 &ldquo;completion groups.&rdquo;<br>Check <code>doc completions</code> for more information.</p><h5 id=parameters-2 class=heading>Parameters
<a href=#parameters-2 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=cwd><h4 class=heading>hilbish.cwd() -> string
<a href=#cwd class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Returns the current directory of the shell</p><h5 id=parameters-3 class=heading>Parameters
<a href=#parameters-3 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=exec><h4 class=heading>hilbish.exec(cmd)
@ -22,57 +18,32 @@ Check <code>doc completions</code> for more information.</p><h5 id=parameters-2
<a href=#parameters-4 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=goro><h4 class=heading>hilbish.goro(fn)
<a href=#goro class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Puts <code>fn</code> in a goroutine</p><h5 id=parameters-5 class=heading>Parameters
<a href=#parameters-5 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=highlighter><h4 class=heading>hilbish.highlighter(line)
<a href=#highlighter class=heading-link><i class="fas fa-paperclip"></i></a></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.
Note that to set a highlighter, one has to override this function.
Example:</p><pre tabindex=0><code>function hilbish.highlighter(line)
return line:gsub(&#39;&#34;%w+&#34;&#39;, function(c) return lunacolors.green(c) end)
end
</code></pre><p>This code will highlight all double quoted strings in green.</p><h5 id=parameters-6 class=heading>Parameters
<a href=#highlighter class=heading-link><i class="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><div class=highlight><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=ln>1</span><span class=cl>function hilbish.highlighter(line)
</span></span><span class=line><span class=ln>2</span><span class=cl> return line:gsub(&#39;&#34;%w+&#34;&#39;, function(c) return lunacolors.green(c) end)
</span></span><span class=line><span class=ln>3</span><span class=cl>end
</span></span></code></pre></div><p>This code will highlight all double quoted strings in green.</p><h5 id=parameters-6 class=heading>Parameters
<a href=#parameters-6 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=hinter><h4 class=heading>hilbish.hinter(line, pos)
<a href=#hinter class=heading-link><i class="fas fa-paperclip"></i></a></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><h5 id=parameters-7 class=heading>Parameters
<a href=#hinter class=heading-link><i class="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><h5 id=parameters-7 class=heading>Parameters
<a href=#parameters-7 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=inputMode><h4 class=heading>hilbish.inputMode(mode)
<a href=#inputMode class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Sets the input mode for Hilbish&rsquo;s line reader. Accepts either emacs or vim</p><h5 id=parameters-8 class=heading>Parameters
<a href=#parameters-8 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=interval><h4 class=heading>hilbish.interval(cb, time) -> <a href=/Hilbish/docs/api/hilbish/hilbish.timers/#timer style=text-decoration:none id=lol>Timer</a>
<a href=#interval class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Runs the <code>cb</code> function every <code>time</code> milliseconds.
This creates a timer that starts immediately.</p><h5 id=parameters-9 class=heading>Parameters
<a href=#interval class=heading-link><i class="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><h5 id=parameters-9 class=heading>Parameters
<a href=#parameters-9 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=multiprompt><h4 class=heading>hilbish.multiprompt(str)
<a href=#multiprompt class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Changes the continued line prompt to <code>str</code></p><h5 id=parameters-10 class=heading>Parameters
<a href=#parameters-10 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=prependPath><h4 class=heading>hilbish.prependPath(dir)
<a href=#prependPath class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Prepends <code>dir</code> to $PATH</p><h5 id=parameters-11 class=heading>Parameters
<a href=#parameters-11 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=prompt><h4 class=heading>hilbish.prompt(str, typ)
<a href=#prompt class=heading-link><i class="fas fa-paperclip"></i></a></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>%d</code> - Current working directory
<code>%u</code> - Name of current user
<code>%h</code> - Hostname of device</p><h5 id=parameters-12 class=heading>Parameters
<a href=#prompt class=heading-link><i class="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><h5 id=parameters-12 class=heading>Parameters
<a href=#parameters-12 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=read><h4 class=heading>hilbish.read(prompt) -> input (string)
<a href=#read class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Read input from the user, using Hilbish&rsquo;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&rsquo;t happen)</p><h5 id=parameters-13 class=heading>Parameters
<a href=#read class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Read input from the user, using Hilbish&rsquo;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&rsquo;t happen)</p><h5 id=parameters-13 class=heading>Parameters
<a href=#parameters-13 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=run><h4 class=heading>hilbish.run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string)
<a href=#run class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Runs <code>cmd</code> in Hilbish&rsquo;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><h5 id=parameters-14 class=heading>Parameters
<a href=#run class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Runs <code>cmd</code> in Hilbish&rsquo;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><h5 id=parameters-14 class=heading>Parameters
<a href=#parameters-14 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=runnerMode><h4 class=heading>hilbish.runnerMode(mode)
<a href=#runnerMode class=heading-link><i class="fas fa-paperclip"></i></a></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><h5 id=parameters-15 class=heading>Parameters
<a href=#runnerMode class=heading-link><i class="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><h5 id=parameters-15 class=heading>Parameters
<a href=#parameters-15 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=timeout><h4 class=heading>hilbish.timeout(cb, time) -> <a href=/Hilbish/docs/api/hilbish/hilbish.timers/#timer style=text-decoration:none id=lol>Timer</a>
<a href=#timeout class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Runs the <code>cb</code> function after <code>time</code> in milliseconds.
This creates a timer that starts immediately.</p><h5 id=parameters-16 class=heading>Parameters
<a href=#timeout class=heading-link><i class="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><h5 id=parameters-16 class=heading>Parameters
<a href=#parameters-16 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=which><h4 class=heading>hilbish.which(name) -> string
<a href=#which class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Checks if <code>name</code> is a valid command.
Will return the path of the binary, or a basename if it&rsquo;s a commander.</p><h5 id=parameters-17 class=heading>Parameters
<a href=#which class=heading-link><i class="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&rsquo;s a commander.</p><h5 id=parameters-17 class=heading>Parameters
<a href=#parameters-17 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><h3 id=types class=heading>Types
<a href=#types class=heading-link><i class="fas fa-paperclip"></i></a></h3><hr><h3 id=sink class=heading>Sink
<a href=#sink class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>A sink is a structure that has input and/or output to/from

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>API on Hilbish</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/</link><description>Recent content in API on Hilbish</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/index.xml" rel="self" type="application/rss+xml"/><item><title>Module bait</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/bait/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/bait/</guid><description>Introduction Bait is the event emitter for Hilbish. Much like Node.js and its events system, many actions in Hilbish emit events. Unlike Node.js, Hilbish events are global. So make sure to pick a unique name!
Usage of the Bait module consists of userstanding event-driven architecture, but it&amp;rsquo;s pretty simple: If you want to act on a certain event, you can catch it. You can act on events via callback functions.</description></item><item><title>Module commander</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/commander/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/commander/</guid><description>Introduction Commander is the library which handles Hilbish commands. This makes the user able to add Lua-written commands to their shell without making a separate script in a bin folder. Instead, you may simply use the Commander library in your Hilbish config.
1local commander = require &amp;#39;commander&amp;#39; 2 3commander.register(&amp;#39;hello&amp;#39;, function(args, sinks) 4 sinks.out:writeln &amp;#39;Hello world!&amp;#39; 5end) In this example, a command with the name of hello is created that will print Hello world!</description></item><item><title>Module fs</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/</guid><description>Introduction The fs module provides easy and simple access to filesystem functions and other things, and acts an addition to the Lua standard library&amp;rsquo;s I/O and filesystem functions.
Functions abs(path) -&amp;gt; string Gives an absolute version of path. basename(path) -&amp;gt; string Gives the basename of path. For the rules, cd(dir) Changes directory to dir dir(path) -&amp;gt; string Returns the directory part of path. For the rules, see Go&amp;rsquo;s glob(pattern) -&amp;gt; matches (table) Glob all files and directories that match the pattern.</description></item><item><title>Module terminal</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/terminal/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/terminal/</guid><description>Introduction The terminal library is a simple and lower level library for certain terminal interactions.
1local commander = require &amp;#39;commander&amp;#39; 2 3commander.register(&amp;#39;hello&amp;#39;, function(args, sinks) 4 sinks.out:writeln &amp;#39;Hello world!&amp;#39; 5end) In this example, a command with the name of hello is created that will print Hello world!</description></item><item><title>Module fs</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/</guid><description>Introduction The fs module provides filesystem functions to Hilbish. While Lua&amp;rsquo;s standard library has some I/O functions, they&amp;rsquo;re missing a lot of the basics. The fs library offers more functions and will work on any operating system Hilbish does.
Functions abs(path) -&amp;gt; string Returns an absolute version of the path. basename(path) -&amp;gt; string Returns the &amp;ldquo;basename,&amp;rdquo; or the last part of the provided path. If path is empty, cd(dir) Changes Hilbish&amp;rsquo;s directory to dir.</description></item><item><title>Module terminal</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/terminal/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/terminal/</guid><description>Introduction The terminal library is a simple and lower level library for certain terminal interactions.
Functions restoreState() Restores the last saved state of the terminal saveState() Saves the current state of the terminal setRaw() Puts the terminal in raw mode size() Gets the dimensions of the terminal. Returns a table with width and height terminal.restoreState() Restores the last saved state of the terminal
Parameters This function has no parameters.</description></item></channel></rss>

View File

@ -10,6 +10,5 @@
<a href=#parameters-1 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=setRaw><h4 class=heading>terminal.setRaw()
<a href=#setRaw class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Puts the terminal in raw mode</p><h5 id=parameters-2 class=heading>Parameters
<a href=#parameters-2 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><div id=size><h4 class=heading>terminal.size()
<a href=#size class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Gets the dimensions of the terminal. Returns a table with <code>width</code> and <code>height</code>
Note: this is not the size in relation to the dimensions of the display</p><h5 id=parameters-3 class=heading>Parameters
<a href=#size class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Gets the dimensions of the terminal. Returns a table with <code>width</code> and <code>height</code><br>Note: this is not the size in relation to the dimensions of the display</p><h5 id=parameters-3 class=heading>Parameters
<a href=#parameters-3 class=heading-link><i class="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div></div><div class="footer mt-auto"><p class="card-small text-muted">Want to help improve this page? <a href=https://github.com/Rosettea/Hilbish/issues/new/choose>Create an issue.</a></p></div></container></div><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea &copy; 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html>

View File

@ -18,8 +18,8 @@ When prompted, you can put the path for Hilbish.</p><h3 id=default-with-terminal
<a href=#default-with-terminal class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>The simpler way is to set the default shell for your terminal. The way of
doing this depends on how your terminal settings are configured.</p><h3 id=run-after-login-shell class=heading>Run after login shell
<a href=#run-after-login-shell class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>Some shells (like zsh) have an rc file, like <code>.zlogin</code>, which is ran when the shell session
is a login shell. In that file, you can run Hilbish. Example:</p><pre tabindex=0><code>exec hilbish -S -l
</code></pre><p>This will replace the shell with Hilbish, set $SHELL to Hilbish and launch it as a login shell.</p><h2 id=configuration class=heading>Configuration
is a login shell. In that file, you can run Hilbish. Example:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=ln>1</span><span class=cl>exec hilbish -S -l
</span></span></code></pre></div><p>This will replace the shell with Hilbish, set $SHELL to Hilbish and launch it as a login shell.</p><h2 id=configuration class=heading>Configuration
<a href=#configuration class=heading-link><i class="fas fa-paperclip"></i></a></h2><p>Once installation and setup has been done, you can then configure Hilbish.
It is configured and scripted via Lua, so the config file is a Lua file.
You can use any pure Lua library to do whatever you want.</p><p>Hilbish&rsquo;s sample configuration is usually located in <code>hilbish.dataDir .. '/.hilbishrc.lua'</code>.

View File

@ -32,8 +32,8 @@ hilbish.cancel &amp;gt; Sent when the user cancels their input with Ctrl-C.</des
You can download both at any time, but note that the development builds may have breaking changes.
For the latest stable release, check here: https://github.com/Rosettea/Hilbish/releases/latest For a development build: https://nightly.link/Rosettea/Hilbish/workflows/build/master Compiling To read the steps for compiling Hilbish, head over to the GitHub repository.</description></item><item><title>Module bait</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/bait/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/bait/</guid><description>Introduction Bait is the event emitter for Hilbish. Much like Node.js and its events system, many actions in Hilbish emit events. Unlike Node.js, Hilbish events are global. So make sure to pick a unique name!
Usage of the Bait module consists of userstanding event-driven architecture, but it&amp;rsquo;s pretty simple: If you want to act on a certain event, you can catch it. You can act on events via callback functions.</description></item><item><title>Module commander</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/commander/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/commander/</guid><description>Introduction Commander is the library which handles Hilbish commands. This makes the user able to add Lua-written commands to their shell without making a separate script in a bin folder. Instead, you may simply use the Commander library in your Hilbish config.
1local commander = require &amp;#39;commander&amp;#39; 2 3commander.register(&amp;#39;hello&amp;#39;, function(args, sinks) 4 sinks.out:writeln &amp;#39;Hello world!&amp;#39; 5end) In this example, a command with the name of hello is created that will print Hello world!</description></item><item><title>Module fs</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/</guid><description>Introduction The fs module provides easy and simple access to filesystem functions and other things, and acts an addition to the Lua standard library&amp;rsquo;s I/O and filesystem functions.
Functions abs(path) -&amp;gt; string Gives an absolute version of path. basename(path) -&amp;gt; string Gives the basename of path. For the rules, cd(dir) Changes directory to dir dir(path) -&amp;gt; string Returns the directory part of path. For the rules, see Go&amp;rsquo;s glob(pattern) -&amp;gt; matches (table) Glob all files and directories that match the pattern.</description></item><item><title>Module hilbish.aliases</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/</guid><description>Introduction The alias interface deals with all command aliases in Hilbish.
1local commander = require &amp;#39;commander&amp;#39; 2 3commander.register(&amp;#39;hello&amp;#39;, function(args, sinks) 4 sinks.out:writeln &amp;#39;Hello world!&amp;#39; 5end) In this example, a command with the name of hello is created that will print Hello world!</description></item><item><title>Module fs</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/fs/</guid><description>Introduction The fs module provides filesystem functions to Hilbish. While Lua&amp;rsquo;s standard library has some I/O functions, they&amp;rsquo;re missing a lot of the basics. The fs library offers more functions and will work on any operating system Hilbish does.
Functions abs(path) -&amp;gt; string Returns an absolute version of the path. basename(path) -&amp;gt; string Returns the &amp;ldquo;basename,&amp;rdquo; or the last part of the provided path. If path is empty, cd(dir) Changes Hilbish&amp;rsquo;s directory to dir.</description></item><item><title>Module hilbish.aliases</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/</guid><description>Introduction The alias interface deals with all command aliases in Hilbish.
Functions add(alias, cmd) This is an alias (ha) for the hilbish.alias function. delete(name) Removes an alias. list() -&amp;gt; table&amp;lt;string, string&amp;gt; Get a table of all aliases, with string keys as the alias and the value as the command. resolve(alias) -&amp;gt; command (string) Tries to resolve an alias to its command. hilbish.aliases.add(alias, cmd) This is an alias (ha) for the hilbish.</description></item><item><title>Module hilbish.completions</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.completions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.completions/</guid><description>Introduction The completions interface deals with tab completions.
Functions call(name, query, ctx, fields) -&amp;gt; completionGroups (table), prefix (string) Calls a completer function. This is mainly used to call handler(line, pos) The handler function is the callback for tab completion in Hilbish. bins(query, ctx, fields) -&amp;gt; entries (table), prefix (string) Returns binary/executale completion candidates based on the provided query. files(query, ctx, fields) -&amp;gt; entries (table), prefix (string) Returns file completion candidates based on the provided query.</description></item><item><title>Module hilbish.editor</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.editor/</guid><description>Introduction The hilbish.editor interface provides functions to directly interact with the line editor in use.
Functions getLine() -&amp;gt; string Returns the current input line. getVimRegister(register) -&amp;gt; string Returns the text that is at the register. insert(text) Inserts text into the line. getChar() -&amp;gt; string Reads a keystroke from the user. This is in a format setVimRegister(register, text) Sets the vim register at register to hold the passed text. hilbish.editor.getLine() -> string Returns the current input line.</description></item><item><title>Module hilbish.history</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.history/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/docs/api/hilbish/hilbish.history/</guid><description>Introduction The history interface deals with command history. This includes the ability to override functions to change the main method of saving history.

View File

@ -9,15 +9,15 @@ have breaking changes.</p><p>For the latest <strong>stable release</strong>, che
<a href=#compiling class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>To read the steps for compiling Hilbish, head over to the <a href=https://github.com/Rosettea/Hilbish#build target=_blank rel=noopener>GitHub repository.</a></p><h3 id=package-repositories class=heading>Package Repositories
<a href=#package-repositories class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>Methods of installing Hilbish for your Linux distro.</p><h4 id=fedora-copr class=heading>Fedora (COPR)
<a href=#fedora-copr class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>An official COPR is offered to install Hilbish easily on Fedora.
Enable the repo:</p><pre tabindex=0><code>sudo dnf copr enable sammyette/Hilbish
</code></pre><p>And install Hilbish:</p><pre tabindex=0><code>sudo dnf install hilbish
</code></pre><p>Or for the latest development build from master:</p><pre tabindex=0><code>sudo dnf install hilbish-git
</code></pre><h4 id=arch-linux-aur class=heading>Arch Linux (AUR)
Enable the repo:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=ln>1</span><span class=cl>sudo dnf copr enable sammyette/Hilbish
</span></span></code></pre></div><p>And install Hilbish:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=ln>1</span><span class=cl>sudo dnf install hilbish
</span></span></code></pre></div><p>Or for the latest development build from master:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=ln>1</span><span class=cl>sudo dnf install hilbish-git
</span></span></code></pre></div><h4 id=arch-linux-aur class=heading>Arch Linux (AUR)
<a href=#arch-linux-aur class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Hilbish is on the AUR. Setup an AUR helper, and install.
Example with yay:</p><pre tabindex=0><code>yay -S hilbish
</code></pre><p>Or, from master branch:</p><pre tabindex=0><code>yay -S hilbish-git
</code></pre><h4 id=alpine-linux class=heading>Alpine Linux
Example with yay:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=ln>1</span><span class=cl>yay -S hilbish
</span></span></code></pre></div><p>Or, from master branch:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=ln>1</span><span class=cl>yay -S hilbish-git
</span></span></code></pre></div><h4 id=alpine-linux class=heading>Alpine Linux
<a href=#alpine-linux class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Hilbish is currentlty in the testing/edge repository for Alpine.
Follow the steps <a href=https://wiki.alpinelinux.org/wiki/Enable_Community_Repository target=_blank rel=noopener>here</a>
(Using testing repositories) and install:</p><pre tabindex=0><code>apk add hilbish
</code></pre></div></main><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea &copy; 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html>
(Using testing repositories) and install:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=ln>1</span><span class=cl>apk add hilbish
</span></span></code></pre></div></div></main><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea &copy; 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html>