From d512e1173520cf1e496eb898ec62fd121b2aa4ba Mon Sep 17 00:00:00 2001
From: TorchedSammy
end)
What this does is, whenever the command.exit
event is thrown,
this function will set the user prompt.
catch(name, cb) | Catches a hook with name . Runs the cb when it is thrown |
catchOnce(name, cb) | Same as catch, but only runs the cb once and then removes the hook |
hooks(name) -> table | Returns a table with hooks (callback functions) on the event with name . |
release(name, catcher) | Removes the catcher for the event with name . |
throw(name, …args) | Throws a hook with name with the provided args |
catch(name, cb) | Catches a hook with name . Runs the cb when it is thrown |
catchOnce(name, cb) | Same as catch, but only runs the cb once and then removes the hook |
hooks(name) -> table | Returns a table with hooks (callback functions) on the event with name . |
release(name, catcher) | Removes the catcher for the event with name . |
throw(name, …args) | Throws a hook with name with the provided args |
Catches a hook with name
. Runs the cb
when it is thrown
string
name
ummm
function
cb
?
Same as catch, but only runs the cb
once and then removes the hook
err
. The values of these is a 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.deregister(name) | Deregisters any command registered with name |
register(name, cb) | Register a command with name that runs cb when ran |
deregister(name) | Deregisters any command registered with name |
register(name, cb) | Register a command with name that runs cb when ran |
Deregisters any command registered with name
This function has no parameters.
Register a command with name
that runs cb
when ran
The fs module provides easy and simple access to filesystem functions and other things, and acts an addition to the Lua standard library’s I/O and filesystem functions.
abs(path) -> string | Gives an absolute version of path . |
basename(path) -> string | Gives the basename of path . For the rules, |
cd(dir) | Changes directory to dir |
dir(path) -> string | Returns the directory part of path . For the rules, see Go’s |
glob(pattern) -> matches (table) | Glob all files and directories that match the pattern. |
join(…) -> string | Takes paths and joins them together with the OS’s |
mkdir(name, recursive) | Makes a directory called name . If recursive is true, it will create its parent directories. |
readdir(dir) -> {} | Returns a table of files in dir . |
stat(path) -> {} | Returns a table of info about the path . |
abs(path) -> string | Gives an absolute version of path . |
basename(path) -> string | Gives the basename of path . For the rules, |
cd(dir) | Changes directory to dir |
dir(path) -> string | Returns the directory part of path . For the rules, see Go’s |
glob(pattern) -> matches (table) | Glob all files and directories that match the pattern. |
join(…) -> string | Takes paths and joins them together with the OS’s |
mkdir(name, recursive) | Makes a directory called name . If recursive is true, it will create its parent directories. |
readdir(dir) -> {} | Returns a table of files in dir . |
stat(path) -> {} | Returns a table of info about the path . |
Gives an absolute version of path
.
This function has no parameters.
Gives the basename of path
. For the rules,
diff --git a/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/index.html b/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/index.html
index e992ff4..97f37b1 100644
--- a/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/index.html
+++ b/versions/doc-improvements/docs/api/hilbish/hilbish.aliases/index.html
@@ -3,8 +3,7 @@
command aliasing
The alias interface deals with all command aliases in Hilbish.
add(alias, cmd) | This is an alias (ha) for the hilbish.alias function. |
delete(name) | Removes an alias. |
list() -> table<string, string> | Get a table of all aliases, with string keys as the alias and the value as the command. |
resolve(alias) -> command (string) | Tries to resolve an alias to its command. |
add(alias, cmd) | This is an alias (ha) for the hilbish.alias function. |
delete(name) | Removes an alias. |
list() -> table<string, string> | Get a table of all aliases, with string keys as the alias and the value as the command. |
resolve(alias) -> command (string) | Tries to resolve an alias to its command. |
This is an alias (ha) for the hilbish.alias
function.
This function has no parameters.
Removes an alias.
tab completions
The completions interface deals with tab completions.
call(name, query, ctx, fields) -> 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) -> entries (table), prefix (string) | Returns binary/executale completion candidates based on the provided query. |
files(query, ctx, fields) -> entries (table), prefix (string) | Returns file completion candidates based on the provided query. |
call(name, query, ctx, fields) -> 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) -> entries (table), prefix (string) | Returns binary/executale completion candidates based on the provided query. |
files(query, ctx, fields) -> entries (table), prefix (string) | Returns file completion candidates based on the provided query. |
Calls a completer function. This is mainly used to call
a command completer, which will have a name
in the form
of command.name
, example: command.git
.
diff --git a/versions/doc-improvements/docs/api/hilbish/hilbish.editor/index.html b/versions/doc-improvements/docs/api/hilbish/hilbish.editor/index.html
index b0f8466..4312acf 100644
--- a/versions/doc-improvements/docs/api/hilbish/hilbish.editor/index.html
+++ b/versions/doc-improvements/docs/api/hilbish/hilbish.editor/index.html
@@ -4,8 +4,7 @@
interactions for Hilbish's line reader
The hilbish.editor interface provides functions to directly interact with the line editor in use.
getLine() -> string | Returns the current input line. |
getVimRegister(register) -> string | Returns the text that is at the register. |
insert(text) | Inserts text into the line. |
setVimRegister(register, text) | Sets the vim register at register to hold the passed text. |
getLine() -> string | Returns the current input line. |
getVimRegister(register) -> string | Returns the text that is at the register. |
insert(text) | Inserts text into the line. |
setVimRegister(register, text) | Sets the vim register at register to hold the passed text. |
Returns the current input line.
This function has no parameters.
Returns the text that is at the register.
The history interface deals with command history. This includes the ability to override functions to change the main method of saving history.
add(cmd) | Adds a command to the history. |
all() -> table | Retrieves all history. |
clear() | Deletes all commands from the history. |
get(idx) | Retrieves a command from the history based on the idx . |
size() -> number | Returns the amount of commands in the history. |
add(cmd) | Adds a command to the history. |
all() -> table | Retrieves all history. |
clear() | Deletes all commands from the history. |
get(idx) | Retrieves a command from the history based on the idx . |
size() -> number | Returns the amount of commands in the history. |
Retrieves all history.
background job management
Manage interactive jobs in Hilbish via Lua.
Jobs are the name of background tasks/commands. A job can be started via interactive usage or with the functions defined below for use in external runners.
add(cmdstr, args, execPath) | Adds a new job to the job table. Note that this does not immediately run it. |
all() -> table<@Job> | Returns a table of all job objects. |
disown(id) | Disowns a job. This deletes it from the job table. |
get(id) -> @Job | Get a job object via its ID. |
last() -> @Job | Returns the last added job from the table. |
add(cmdstr, args, execPath) | Adds a new job to the job table. Note that this does not immediately run it. |
all() -> table<@Job> | Returns a table of all job objects. |
disown(id) | Disowns a job. This deletes it from the job table. |
get(id) -> @Job | Get a job object via its ID. |
last() -> @Job | Returns the last added job from the table. |
Adds a new job to the job table. Note that this does not immediately run it.
This function has no parameters.
Returns a table of all job objects.
setMode(cb) | This is the same as the hilbish.runnerMode function. It takes a callback, |
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. |
setMode(cb) | This is the same as the hilbish.runnerMode function. It takes a callback, |
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. |
This is the same as the hilbish.runnerMode
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,
diff --git a/versions/doc-improvements/docs/api/hilbish/hilbish.timers/index.html b/versions/doc-improvements/docs/api/hilbish/hilbish.timers/index.html
index e9a6e79..006c410 100644
--- a/versions/doc-improvements/docs/api/hilbish/hilbish.timers/index.html
+++ b/versions/doc-improvements/docs/api/hilbish/hilbish.timers/index.html
@@ -15,8 +15,7 @@ t:start()
print(t.running) // true
create(type, time, callback) -> @Timer | Creates a timer that runs based on the specified time in milliseconds. |
get(id) -> @Timer | Retrieves a timer via its ID. |
INTERVAL | Constant for an interval timer type |
TIMEOUT | Constant for a timeout timer type |
INTERVAL | Constant for an interval timer type |
TIMEOUT | Constant for a timeout timer type |
Creates a timer that runs based on the specified time
in milliseconds.
The type
can either be hilbish.timers.INTERVAL
or hilbish.timers.TIMEOUT
This function has no parameters.
The Hilbish module includes the core API, containing interfaces and functions which directly relate to shell functionality.
alias(cmd, orig) | Sets an alias of cmd to orig |
appendPath(dir) | Appends dir to $PATH |
complete(scope, cb) | Registers a completion handler for scope . |
cwd() -> string | Returns the current directory of the shell |
exec(cmd) | Replaces running hilbish with cmd |
goro(fn) | Puts fn in a goroutine |
highlighter(line) | Line highlighter handler. This is mainly for syntax highlighting, but in |
hinter(line, pos) | The command line hint handler. It gets called on every key insert to |
inputMode(mode) | Sets the input mode for Hilbish’s line reader. Accepts either emacs or vim |
interval(cb, time) -> @Timer | Runs the cb function every time milliseconds. |
multiprompt(str) | Changes the continued line prompt to str |
prependPath(dir) | Prepends dir to $PATH |
prompt(str, typ) | Changes the shell prompt to str |
read(prompt) -> input (string) | Read input from the user, using Hilbish’s line editor/input reader. |
run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string) | Runs cmd in Hilbish’s sh interpreter. |
runnerMode(mode) | Sets the execution/runner mode for interactive Hilbish. This determines whether |
timeout(cb, time) -> @Timer | Runs the cb function after time in milliseconds. |
which(name) -> string | Checks if name is a valid command. |
ver | The version of Hilbish |
goVersion | The version of Go that Hilbish was compiled with |
user | Username of the user |
host | Hostname of the machine |
dataDir | Directory for Hilbish data files, including the docs and default modules |
interactive | Is Hilbish in an interactive shell? |
login | Is Hilbish the login shell? |
vimMode | Current Vim input mode of Hilbish (will be nil if not in Vim input mode) |
exitCode | xit code of the last executed command |
ver | The version of Hilbish |
goVersion | The version of Go that Hilbish was compiled with |
user | Username of the user |
host | Hostname of the machine |
dataDir | Directory for Hilbish data files, including the docs and default modules |
interactive | Is Hilbish in an interactive shell? |
login | Is Hilbish the login shell? |
vimMode | Current Vim input mode of Hilbish (will be nil if not in Vim input mode) |
exitCode | xit code of the last executed command |
Appends dir
to $PATH
low level terminal library
The terminal library is a simple and lower level library for certain terminal interactions.
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 |
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 |
Restores the last saved state of the terminal
This function has no parameters.
Saves the current state of the terminal