gh-pages
TorchedSammy 2023-01-20 23:08:02 +00:00
parent 4ed68f70cc
commit 805450c744
3 changed files with 22 additions and 7 deletions

View File

@ -3,7 +3,24 @@
Hilbish</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/ class=nav-link>Home</a></li><li class=nav-item><a href=/Hilbish/install/ class=nav-link>Install</a></li><li class=nav-item><a href=/Hilbish/docs/ class=nav-link>Docs</a></li><li class=nav-item><a href=/Hilbish/blog/ class=nav-link>Blog</a></li></ul></div></div></nav></header><div class="container py-3 row"><div class=container style=width:240px><div class="p-3 col"><ul class="nav nav-pills mb-auto-collapse" id=navbarSupportedContent><li class=nav-item><a href=/Hilbish/docs/ class=nav-link><strong>Introduction</strong></a></li><li class=nav-item><a href=/Hilbish/docs/getting-started/ class=nav-link><strong>Getting Started</strong></a></li><li class=nav-item><a href=/Hilbish/docs/faq/ class=nav-link><strong>Frequently Asked Questions</strong></a></li><li class=nav-item><a href=/Hilbish/docs/features/ class=nav-link><strong>Features</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/docs/features/runner-mode/ class=nav-link>Runner Mode</a></li></ul><li class=nav-item><a href=/Hilbish/docs/api/ class=nav-link><strong>API</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/docs/api/hilbish/hilbish.aliases/ class=nav-link>Interface hilbish.aliases</a></li><li class=nav-item><a href=/Hilbish/docs/api/hilbish/hilbish.completions/ class=nav-link>Interface hilbish.completions</a></li><li class=nav-item><a href=/Hilbish/docs/api/hilbish/hilbish.editor/ class=nav-link>Interface hilbish.editor</a></li><li class=nav-item><a href=/Hilbish/docs/api/hilbish/hilbish.history/ class=nav-link>Interface hilbish.history</a></li><li class=nav-item><a href=/Hilbish/docs/api/hilbish/hilbish.jobs/ class=nav-link>Interface hilbish.jobs</a></li><li class=nav-item><a href=/Hilbish/docs/api/hilbish/hilbish.os/ class=nav-link>Interface hilbish.os</a></li><li class=nav-item><a href=/Hilbish/docs/api/hilbish/hilbish.runner/ class=nav-link>Interface hilbish.runner</a></li><li class=nav-item><a href=/Hilbish/docs/api/hilbish/hilbish.timers/ class=nav-link>Interface hilbish.timers</a></li><li class=nav-item><a href=/Hilbish/docs/api/hilbish/hilbish.userdir/ class=nav-link>Interface hilbish.userDir</a></li><li class=nav-item><a href=/Hilbish/docs/api/bait/ class=nav-link>Module bait</a></li><li class=nav-item><a href=/Hilbish/docs/api/commander/ class=nav-link>Module commander</a></li><li class=nav-item><a href=/Hilbish/docs/api/fs/ class=nav-link>Module fs</a></li><li class=nav-item><a href=/Hilbish/docs/api/hilbish/ class=nav-link>Module hilbish</a></li><li class=nav-item><a href=/Hilbish/docs/api/terminal/ class=nav-link>Module terminal</a></li></ul></ul></div></div><div class="p-3 col"><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.</p><h3 id=functions class=heading>Functions
<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.
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:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-lua data-lang=lua><span style=display:flex><span><span style=color:#66d9ef>local</span> commander <span style=color:#f92672>=</span> require <span style=color:#e6db74>&#39;commander&#39;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>commander.register(<span style=color:#e6db74>&#39;hello&#39;</span>, <span style=color:#66d9ef>function</span>(args, sinks)
</span></span><span style=display:flex><span> sinks.out:writeln <span style=color:#e6db74>&#39;Hello world!&#39;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>end</span>)
</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
have is: What is the <code>sinks</code> parameter?</p><p>A sink is a writable/readable pipe, or you can imagine a Lua
file. It&rsquo;s used in this case to write to the proper output,
incase a user either pipes to another command or redirects somewhere else.</p><p>So, the <code>sinks</code> parameter is a table containing 3 sinks:
<code>in</code>, <code>out</code>, and <code>err</code>.</p><ul><li><code>in</code> is the standard input. You can read from this sink
to get user input. (<strong>This is currently unimplemented.</strong>)</li><li><code>out</code> is standard output. This is usually where text meant for
output should go.</li><li><code>err</code> is standard error. This sink is for writing errors, as the
name would suggest.</li></ul><p>A sink has 2 methods:</p><ul><li><code>write(str)</code> will write to the sink.</li><li><code>writeln(str)</code> will write to the sink with a newline at the end.</li></ul><h3 id=functions class=heading>Functions
<a href=#functions class=heading-link><i class="fas fa-paperclip"></i></a></h3><h4 id=deregistername class=heading>deregister(name)
<a href=#deregistername class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Deregisters any command registered with <code>name</code></p><h4 id=registername-cb class=heading>register(name, cb)
<a href=#registername-cb 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></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></div></div><footer class="footer mt-auto mt-auto py-3 bg-light row"><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-flower.png alt height=48 class="d-inline-block align-text-top"></a><p class=text-muted>Rosettea &copy; 2022<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><h5>Hilbish</h5><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></footer></body></html>

View File

@ -1,7 +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/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/docs/api/index.xml" rel="self" type="application/rss+xml"/><item><title>Module bait</title><link>https://rosettea.github.io/Hilbish/docs/api/bait/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/docs/api/bait/</guid><description>Introduction Bait is the event emitter for Hilbish. Why name it bait? Why not. It throws hooks that you can catch. This is what you will use if you want to listen in on hooks to know when certain things have happened, like when you&amp;rsquo;ve changed directory, a command has failed, etc. To find all available hooks thrown by Hilbish, see doc hooks.
Functions catch(name, cb) Catches a hook with name.</description></item><item><title>Module commander</title><link>https://rosettea.github.io/Hilbish/docs/api/commander/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/docs/api/commander/</guid><description>Introduction Commander is a library for writing custom commands in Lua.
Functions deregister(name) Deregisters any command registered with name
register(name, cb) Register a command with name that runs cb when ran</description></item><item><title>Module fs</title><link>https://rosettea.github.io/Hilbish/docs/api/fs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/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 catch(name, cb) Catches a hook with name.</description></item><item><title>Module commander</title><link>https://rosettea.github.io/Hilbish/docs/api/commander/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/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:
local commander = require &amp;#39;commander&amp;#39; commander.register(&amp;#39;hello&amp;#39;, function(args, sinks) sinks.out:writeln &amp;#39;Hello world!&amp;#39; end) 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/docs/api/fs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/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) Gives an absolute version of path.
basename(path) Gives the basename of path. For the rules, see Go&amp;rsquo;s filepath.Base
cd(dir) Changes directory to dir

View File

@ -29,9 +29,8 @@ Interface fields family: Family name of the current OS name: Pretty name of the
Functions setMode(cb) This is the same as the hilbish.runnerMode function. It takes a callback, which will be used to execute all interactive input.</description></item><item><title>Interface hilbish.timers</title><link>https://rosettea.github.io/Hilbish/docs/api/hilbish/hilbish.timers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/docs/api/hilbish/hilbish.timers/</guid><description>Introduction If you ever want to run a piece of code on a timed interval, or want to wait a few seconds, you don&amp;rsquo;t have to rely on timing tricks, as Hilbish has a timer API to set intervals and timeouts.
These are the simple functions hilbish.interval and hilbish.timeout (doc accessible with doc hilbish). But if you want slightly more control over them, there is the hilbish.timers interface. It allows you to get a timer via ID and control them.</description></item><item><title>Interface hilbish.userDir</title><link>https://rosettea.github.io/Hilbish/docs/api/hilbish/hilbish.userdir/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/docs/api/hilbish/hilbish.userdir/</guid><description> Introduction This interface just contains properties to know about certain user directories. It is equivalent to XDG on Linux and gets the user&amp;rsquo;s preferred directories for configs and data.
Interface fields config: The user&amp;rsquo;s config directory data: The user&amp;rsquo;s directory for program data</description></item><item><title>Module bait</title><link>https://rosettea.github.io/Hilbish/docs/api/bait/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/docs/api/bait/</guid><description>Introduction Bait is the event emitter for Hilbish. Why name it bait? Why not. It throws hooks that you can catch. This is what you will use if you want to listen in on hooks to know when certain things have happened, like when you&amp;rsquo;ve changed directory, a command has failed, etc. To find all available hooks thrown by Hilbish, see doc hooks.
Functions catch(name, cb) Catches a hook with name.</description></item><item><title>Module commander</title><link>https://rosettea.github.io/Hilbish/docs/api/commander/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/docs/api/commander/</guid><description>Introduction Commander is a library for writing custom commands in Lua.
Functions deregister(name) Deregisters any command registered with name
register(name, cb) Register a command with name that runs cb when ran</description></item><item><title>Module fs</title><link>https://rosettea.github.io/Hilbish/docs/api/fs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/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 catch(name, cb) Catches a hook with name.</description></item><item><title>Module commander</title><link>https://rosettea.github.io/Hilbish/docs/api/commander/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/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:
local commander = require &amp;#39;commander&amp;#39; commander.register(&amp;#39;hello&amp;#39;, function(args, sinks) sinks.out:writeln &amp;#39;Hello world!&amp;#39; end) 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/docs/api/fs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/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) Gives an absolute version of path.
basename(path) Gives the basename of path. For the rules, see Go&amp;rsquo;s filepath.Base
cd(dir) Changes directory to dir