gh-pages
TorchedSammy 2023-12-01 02:19:36 +00:00
parent 675e4a2034
commit cdafa41a8e
3 changed files with 25 additions and 16 deletions

View File

@ -2,11 +2,10 @@
<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 commander — Hilbish" property="og:title"><meta content="library for custom commands" property="og:description"><meta content="library for custom commands" 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> <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 commander — Hilbish" property="og:title"><meta content="library for custom commands" property="og:description"><meta content="library for custom commands" 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"> </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 commander</h1><p><em>library for custom commands<br></em></p><h3 id=introduction class=heading>Introduction <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 commander</h1><p><em>library for custom commands<br></em></p><h3 id=introduction class=heading>Introduction
<a href=#introduction class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>Commander is a library for writing custom commands in Lua. <a href=#introduction class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>Commander is the library which handles Hilbish commands. This makes
In order to make it easier to write commands for Hilbish, the user able to add Lua-written commands to their shell without making
not require separate scripts and to be able to use in a config, a separate script in a bin folder. Instead, you may simply use the Commander
the Commander library exists. This is like a very simple wrapper library in your Hilbish config.</p><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>commander</span> <span class=o>=</span> <span class=n>require</span> <span class=s1>&#39;commander&#39;</span>
that works with Hilbish for writing commands. Example:</p><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>commander</span> <span class=o>=</span> <span class=n>require</span> <span class=s1>&#39;commander&#39;</span>
</span></span><span class=line><span class=ln>2</span><span class=cl> </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=n>commander.register</span><span class=p>(</span><span class=s1>&#39;hello&#39;</span><span class=p>,</span> <span class=kr>function</span><span class=p>(</span><span class=n>args</span><span class=p>,</span> <span class=n>sinks</span><span class=p>)</span> </span></span><span class=line><span class=ln>3</span><span class=cl><span class=n>commander.register</span><span class=p>(</span><span class=s1>&#39;hello&#39;</span><span class=p>,</span> <span class=kr>function</span><span class=p>(</span><span class=n>args</span><span class=p>,</span> <span class=n>sinks</span><span class=p>)</span>
</span></span><span class=line><span class=ln>4</span><span class=cl> <span class=n>sinks.out</span><span class=p>:</span><span class=n>writeln</span> <span class=s1>&#39;Hello world!&#39;</span> </span></span><span class=line><span class=ln>4</span><span class=cl> <span class=n>sinks.out</span><span class=p>:</span><span class=n>writeln</span> <span class=s1>&#39;Hello world!&#39;</span>
@ -14,12 +13,22 @@ that works with Hilbish for writing commands. Example:</p><div class=highlight><
</span></span></code></pre></div><p>In this example, a command with the name of <code>hello</code> is created </span></span></code></pre></div><p>In this example, a command with the name of <code>hello</code> is created
that will print <code>Hello world!</code> to output. One question you may that will print <code>Hello world!</code> to output. One question you may
have is: What is the <code>sinks</code> parameter?</p><p>The <code>sinks</code> parameter is a table with 3 keys: <code>in</code>, <code>out</code>, have is: What is the <code>sinks</code> parameter?</p><p>The <code>sinks</code> parameter is a table with 3 keys: <code>in</code>, <code>out</code>,
and <code>err</code>. The values of these is a <a href=/Hilbish/docs/api/hilbish/#sink style=text-decoration:none>Sink</a>.</p><ul><li><code>in</code> is the standard input. You can read from this sink and <code>err</code>. All of them are a <a href=/Hilbish/docs/api/hilbish/#sink style=text-decoration:none>Sink</a>.</p><ul><li><code>in</code> is the standard input.
to get user input.</li><li><code>out</code> is standard output. This is usually where text meant for You may use the read functions on this sink to get input from the user.</li><li><code>out</code> is standard output.
output should go.</li><li><code>err</code> is standard error. This sink is for writing errors, as the This is usually where command output should go.</li><li><code>err</code> is standard error.
name would suggest.</li></ul><h3 id=functions class=heading>Functions This sink is for writing errors, as the name would suggest.</li></ul><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=#deregister>deregister(name)</a></td><td>Deregisters any command registered with <code>name</code></td></tr><tr><td><a href=#register>register(name, cb)</a></td><td>Register a command with <code>name</code> that runs <code>cb</code> when ran</td></tr></tbody></table><hr><div id=deregister><h4 class=heading>commander.deregister(name) <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>Deregisters any command registered with <code>name</code></p><h5 id=parameters class=heading>Parameters <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>This function has no parameters.</p></div><hr><div id=register><h4 class=heading>commander.register(name, cb) <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>Register a command with <code>name</code> that runs <code>cb</code> when ran</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,
<a href=#parameters-1 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> 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>
</span></span><span class=line><span class=ln>3</span><span class=cl><span class=n>commander.register</span><span class=p>(</span><span class=s1>&#39;hello&#39;</span><span class=p>,</span> <span class=kr>function</span><span class=p>(</span><span class=n>args</span><span class=p>,</span> <span class=n>sinks</span><span class=p>)</span>
</span></span><span class=line><span class=ln>4</span><span class=cl> <span class=kd>local</span> <span class=n>name</span> <span class=o>=</span> <span class=s1>&#39;world&#39;</span>
</span></span><span class=line><span class=ln>5</span><span class=cl> <span class=kr>if</span> <span class=o>#</span><span class=n>args</span> <span class=o>&gt;</span> <span class=mi>0</span> <span class=kr>then</span> <span class=n>name</span> <span class=o>=</span> <span class=n>args</span><span class=p>[</span><span class=mi>1</span><span class=p>]</span> <span class=kr>end</span>
</span></span><span class=line><span class=ln>6</span><span class=cl>
</span></span><span class=line><span class=ln>7</span><span class=cl> <span class=n>sinks.out</span><span class=p>:</span><span class=n>writeln</span><span class=p>(</span><span class=s1>&#39;Hello &#39;</span> <span class=o>..</span> <span class=n>name</span><span class=p>)</span>
</span></span><span class=line><span class=ln>8</span><span class=cl><span class=kr>end</span><span class=p>)</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

@ -1,5 +1,5 @@
<?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! <?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 a library for writing custom commands in Lua. In order to make it easier to write commands for Hilbish, not require separate scripts and to be able to use in a config, the Commander library exists. This is like a very simple wrapper that works with Hilbish for writing commands. Example: 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. 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. 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.
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 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

View File

@ -31,7 +31,7 @@ hilbish.vimAction -&amp;gt; actionName, args &amp;gt; Sent when the user does a
hilbish.cancel &amp;gt; Sent when the user cancels their input with Ctrl-C.</description></item><item><title>Install</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/install/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/install/</guid><description>Official Binaries The best way to get Hilbish is to get a build directly from GitHub. At any time, there are 2 versions of Hilbish recommended for download: the latest stable release, and development builds from the master branch. hilbish.cancel &amp;gt; Sent when the user cancels their input with Ctrl-C.</description></item><item><title>Install</title><link>https://rosettea.github.io/Hilbish/versions/doc-improvements/install/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/doc-improvements/install/</guid><description>Official Binaries The best way to get Hilbish is to get a build directly from GitHub. At any time, there are 2 versions of Hilbish recommended for download: the latest stable release, and development builds from the master branch.
You can download both at any time, but note that the development builds may have breaking changes. 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! 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 a library for writing custom commands in Lua. In order to make it easier to write commands for Hilbish, not require separate scripts and to be able to use in a config, the Commander library exists. This is like a very simple wrapper that works with Hilbish for writing commands. Example: 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. 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. 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.
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 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.