diff --git a/versions/doc-improvements/docs/api/commander/index.html b/versions/doc-improvements/docs/api/commander/index.html index 2e8c68d..582a5f8 100644 --- a/versions/doc-improvements/docs/api/commander/index.html +++ b/versions/doc-improvements/docs/api/commander/index.html @@ -2,11 +2,10 @@
library for custom commands
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:
1local commander = require 'commander'
+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 'commander'
2
3commander.register('hello', function(args, sinks)
4 sinks.out:writeln 'Hello world!'
@@ -14,12 +13,22 @@ that works with Hilbish for writing commands. Example:<
In this example, a command with the name of hello
is created
that will print Hello world!
to output. One question you may
have is: What is the sinks
parameter?
The sinks
parameter is a table with 3 keys: in
, out
,
-and err
. The values of these is a Sink.
in
is the standard input. You can read from this sink
-to get user input.out
is standard output. This is usually where text meant for
-output should go.err
is standard error. This sink is for writing errors, as the
-name would suggest.
Functions
-
deregister(name) Deregisters any command registered with name
register(name, cb) Register a command with name
that runs cb
when ran
commander.deregister(name)
-
Deregisters any command registered with name
Parameters
-
This function has no parameters.