diff --git a/docs/api/hilbish/hilbish.abbr.md b/docs/api/hilbish/hilbish.abbr.md new file mode 100644 index 0000000..163c5fc --- /dev/null +++ b/docs/api/hilbish/hilbish.abbr.md @@ -0,0 +1,67 @@ +--- +title: Module hilbish.abbr +description: command line abbreviations +layout: doc +menu: + docs: + parent: "API" +--- + + +## Introduction +The abbr module manages Hilbish abbreviations. These are words that can be replaced +with longer command line strings when entered. +As an example, `git push` can be abbreviated to `gp`. When the user types +`gp` into the command line, after hitting space or enter, it will expand to `git push`. +Abbreviations can be used as an alternative to aliases. They are saved entirely in the history +Instead of the aliased form of the same command. + +## Functions +||| +|----|----| +|add(abbr, expanded|function, opts)|Adds an abbreviation. The `abbr` is the abbreviation itself,| +|remove(abbr)|Removes the named `abbr`.| +
+
+

+hilbish.abbr.remove(abbr) + + + +

+ +Removes the named `abbr`. +#### Parameters +`abbr` **`string`** + + +
+ +
+
+

+hilbish.abbr.add(abbr, expanded|function, opts) + + + +

+ +Adds an abbreviation. The `abbr` is the abbreviation itself, +while `expanded` is what the abbreviation should expand to. +It can be either a function or a string. If it is a function, it will expand to what +the function returns. +`opts` is a table that accepts 1 key: `anywhere`. +`opts.anywhere` defines whether the abbr expands anywhere in the command line or not, +whereas the default behavior is only at the beginning of the line +#### Parameters +`abbr` **`string`** + + +`expanded|function` **`string`** + + +`opts` **`table`** + + +
+ diff --git a/docs/api/hilbish/hilbish.editor.md b/docs/api/hilbish/hilbish.editor.md index c70b605..6dac64b 100644 --- a/docs/api/hilbish/hilbish.editor.md +++ b/docs/api/hilbish/hilbish.editor.md @@ -14,12 +14,30 @@ directly interact with the line editor in use. ## Functions ||| |----|----| +|deleteByAmount(amount)|Deletes characters in the line by the given amount.| |getLine() -> string|Returns the current input line.| |getVimRegister(register) -> string|Returns the text that is at the register.| |insert(text)|Inserts text into the Hilbish command line.| |getChar() -> string|Reads a keystroke from the user. This is in a format of something like Ctrl-L.| |setVimRegister(register, text)|Sets the vim register at `register` to hold the passed text.| +
+
+

+hilbish.editor.deleteByAmount(amount) + + + +

+ +Deletes characters in the line by the given amount. + +#### Parameters +`number` **`amount`** + + +
+

@@ -96,6 +114,9 @@ hilbish.editor.setVimRegister(register, text) Sets the vim register at `register` to hold the passed text. #### Parameters +`string` **`register`** + + `string` **`text`** diff --git a/docs/api/hilbish/hilbish.messages.md b/docs/api/hilbish/hilbish.messages.md new file mode 100644 index 0000000..2dff7a7 --- /dev/null +++ b/docs/api/hilbish/hilbish.messages.md @@ -0,0 +1,135 @@ +--- +title: Module hilbish.messages +description: simplistic message passing +layout: doc +menu: + docs: + parent: "API" +--- + + +## Introduction +The messages interface defines a way for Hilbish-integrated commands, +user config and other tasks to send notifications to alert the user.z +The `hilbish.message` type is a table with the following keys: +`title` (string): A title for the message notification. +`text` (string): The contents of the message. +`channel` (string): States the origin of the message, `hilbish.*` is reserved for Hilbish tasks. +`summary` (string): A short summary of the `text`. +`icon` (string): Unicode (preferably standard emoji) icon for the message notification +`read` (boolean): Whether the full message has been read or not. + +## Functions +||| +|----|----| +|unreadCount()|Returns the amount of unread messages.| +|readAll()|Marks all messages as read.| +|send(message)|Sends a message.| +|read(idx)|Marks a message at `idx` as read.| +|delete(idx)|Deletes the message at `idx`.| +|clear()|Deletes all messages.| +|all()|Returns all messages.| +
+
+

+hilbish.messages.all() + + + +

+ +Returns all messages. +#### Parameters +This function has no parameters. +
+ +
+
+

+hilbish.messages.clear() + + + +

+ +Deletes all messages. +#### Parameters +This function has no parameters. +
+ +
+
+

+hilbish.messages.delete(idx) + + + +

+ +Deletes the message at `idx`. +#### Parameters +`idx` **`number`** + + +
+ +
+
+

+hilbish.messages.read(idx) + + + +

+ +Marks a message at `idx` as read. +#### Parameters +`idx` **`number`** + + +
+ +
+
+

+hilbish.messages.send(message) + + + +

+ +Sends a message. +#### Parameters +`message` **`hilbish.message`** + + +
+ +
+
+

+hilbish.messages.readAll() + + + +

+ +Marks all messages as read. +#### Parameters +This function has no parameters. +
+ +
+
+

+hilbish.messages.unreadCount() + + + +

+ +Returns the amount of unread messages. +#### Parameters +This function has no parameters. +
+ diff --git a/docs/api/hilbish/hilbish.runner.md b/docs/api/hilbish/hilbish.runner.md index 8c89a52..c4cfbe4 100644 --- a/docs/api/hilbish/hilbish.runner.md +++ b/docs/api/hilbish/hilbish.runner.md @@ -57,6 +57,12 @@ end) |setMode(cb)|This is the same as the `hilbish.runnerMode` function.| |lua(cmd)|Evaluates `cmd` as Lua input. This is the same as using `dofile`| |sh(cmd)|Runs a command in Hilbish's shell script interpreter.| +|exec(cmd, runnerName)|Executes `cmd` with a runner.| +|set(name, runner)|*Sets* a runner by name. The difference between this function and| +|get(name)|Get a runner by name.| +|add(name, runner)|Adds a runner to the table of available runners.| +|setCurrent(name)|Sets Hilbish's runner mode by name.| +|getCurrent()|Returns the current runner by name.|
@@ -114,3 +120,110 @@ This is the equivalent of using `source`.
+
+
+

+hilbish.runner.getCurrent() + + + +

+ +Returns the current runner by name. +#### Parameters +This function has no parameters. +
+ +
+
+

+hilbish.runner.setCurrent(name) + + + +

+ +Sets Hilbish's runner mode by name. +#### Parameters +`name` **`string`** + + +
+ +
+
+

+hilbish.runner.add(name, runner) + + + +

+ +Adds a runner to the table of available runners. +If runner is a table, it must have the run function in it. +#### Parameters +`name` **`string`** + Name of the runner + +`runner` **`function|table`** + + +
+ +
+
+

+hilbish.runner.get(name) + + + +

+ +Get a runner by name. +#### Parameters +`name` **`string`** + Name of the runner to retrieve. + +
+ +
+
+

+hilbish.runner.set(name, runner) + + + +

+ +*Sets* a runner by name. The difference between this function and +add, is set will *not* check if the named runner exists. +The runner table must have the run function in it. +#### Parameters +`name` **`string`** + + +`runner` **`table`** + + +
+ +
+
+

+hilbish.runner.exec(cmd, runnerName) + + + +

+ +Executes `cmd` with a runner. +If `runnerName` is not specified, it uses the default Hilbish runner. +#### Parameters +`cmd` **`string`** + + +`runnerName` **`string?`** + + +
+ diff --git a/emmyLuaDocs/hilbish.lua b/emmyLuaDocs/hilbish.lua index b80a660..a9d8f21 100644 --- a/emmyLuaDocs/hilbish.lua +++ b/emmyLuaDocs/hilbish.lua @@ -13,6 +13,9 @@ function hilbish.aliases.add(alias, cmd) end --- as the higher level functions listed below this will handle it. function hilbish.runner.setMode(cb) end +--- Deletes characters in the line by the given amount. +function hilbish.editor.deleteByAmount(amount) end + --- Returns the current input line. function hilbish.editor.getLine() end