diff --git a/versions/doc-improvements/docs/api/bait/index.html b/versions/doc-improvements/docs/api/bait/index.html index 283b7e6..091948c 100644 --- a/versions/doc-improvements/docs/api/bait/index.html +++ b/versions/doc-improvements/docs/api/bait/index.html @@ -1,7 +1,7 @@
the event emitter
the event emitter
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
diff --git a/versions/doc-improvements/docs/api/commander/index.html b/versions/doc-improvements/docs/api/commander/index.html
index 174ef4a..7347082 100644
--- a/versions/doc-improvements/docs/api/commander/index.html
+++ b/versions/doc-improvements/docs/api/commander/index.html
@@ -1,7 +1,7 @@
library for custom commands
library for custom commands
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 diff --git a/versions/doc-improvements/docs/api/fs/index.html b/versions/doc-improvements/docs/api/fs/index.html index ce95774..81dfa94 100644 --- a/versions/doc-improvements/docs/api/fs/index.html +++ b/versions/doc-improvements/docs/api/fs/index.html @@ -1,7 +1,7 @@
filesystem interaction and functionality library
filesystem interaction and functionality library
The fs module provides filesystem functions to Hilbish. While Lua’s standard
library has some I/O functions, they’re missing a lot of the basics. The fs
library offers more functions and will work on any operating system Hilbish does.
command aliasing
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. |
This is an alias (ha) for the hilbish.alias
function.
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 a command completer, which will have a name |
handler(line, pos) | This function contains the general completion handler for Hilbish. This function handles |
bins(query, ctx, fields) -> entries (table), prefix (string) | Return binaries/executables based on the provided parameters. |
files(query, ctx, fields) -> entries (table), prefix (string) | Returns file matches based on the provided parameters. |
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
.
You can check the Completions doc or doc completions
for info on the completionGroups
return value.
string
name
string
query
string
ctx
table
fields
This function contains the general completion handler for Hilbish. This function handles
completion of everything, which includes calling other command handlers, binaries, and files.
This function can be overriden to supply a custom handler. Note that alias resolution is required to be done in this function.
string
line
The current Hilbish command line
number
pos
Numerical position of the cursor
1-- stripped down version of the default implementation
+ 2function hilbish.completion.handler(line, pos)
+ 3 local query = fields[#fields]
+ 4
+ 5 if #fields == 1 then
+ 6 -- call bins handler here
+ 7 else
+ 8 -- call command completer or files completer here
+ 9 end
+10end
+
Return binaries/executables based on the provided parameters.
This function is meant to be used as a helper in a command completion handler.
string
query
string
ctx
table
fields
1-- an extremely simple completer for sudo.
+ 2hilbish.complete('command.sudo', function(query, ctx, fields)
+ 3 table.remove(fields, 1)
+ 4 if #fields[1] then
+ 5 -- return commands because sudo runs a command as root..!
+ 6
+ 7 local entries, pfx = hilbish.completion.bins(query, ctx, fields)
+ 8 return {
+ 9 type = 'grid',
+10 items = entries
+11 }, pfx
+12 end
+13
+14 -- ... else suggest files or anything else ..
+15end)
+
interactions for Hilbish's line reader
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. |
getChar() -> string | Reads a keystroke from the user. This is in a format |
setVimRegister(register, text) | Sets the vim register at register to hold the passed text. |
command history
command history
The history interface deals with command history. This includes the ability to override functions to change the main method of saving history.
background job management
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. |
native module loading
native module loading
The hilbish.module interface provides a function to load Hilbish plugins/modules. Hilbish modules are Go-written plugins (see https://pkg.go.dev/plugin diff --git a/versions/doc-improvements/docs/api/hilbish/hilbish.os/index.html b/versions/doc-improvements/docs/api/hilbish/hilbish.os/index.html index 86f6a60..ed30ab4 100644 --- a/versions/doc-improvements/docs/api/hilbish/hilbish.os/index.html +++ b/versions/doc-improvements/docs/api/hilbish/hilbish.os/index.html @@ -1,7 +1,7 @@
OS Info
OS Info
The os
interface provides simple text information properties about
the current OS on the systen. This mainly includes the name and
version.
interactive command runner customization
interactive command runner customization
The runner interface contains functions that allow the user to change how Hilbish interprets interactive input. Users can add and change the default runner for interactive input to any 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 e995ddc..4197ddf 100644 --- a/versions/doc-improvements/docs/api/hilbish/hilbish.timers/index.html +++ b/versions/doc-improvements/docs/api/hilbish/hilbish.timers/index.html @@ -1,7 +1,7 @@
timeout and interval API
timeout and interval API
If you ever want to run a piece of code on a timed interval, or want to wait a few seconds, you don’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
diff --git a/versions/doc-improvements/docs/api/hilbish/hilbish.userdir/index.html b/versions/doc-improvements/docs/api/hilbish/hilbish.userdir/index.html
index 35c6d1d..d009cd5 100644
--- a/versions/doc-improvements/docs/api/hilbish/hilbish.userdir/index.html
+++ b/versions/doc-improvements/docs/api/hilbish/hilbish.userdir/index.html
@@ -1,7 +1,7 @@
user-related directories
user-related directories
This interface just contains properties to know about certain user directories. It is equivalent to XDG on Linux and gets the user’s preferred directories for configs and data.
the core Hilbish API
the core Hilbish API
The Hilbish module includes the core API, containing interfaces and functions which directly relate to shell functionality.
alias(cmd, orig) | Sets an alias, with a name of cmd to another command. |
appendPath(dir) | Appends the provided dir to the command path ($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. |
Welcome to the API documentation for Hilbish. This documents Lua functions +
Welcome to the API documentation for Hilbish. This documents Lua functions provided by Hilbish.
low level terminal library
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 |
Restores the last saved state of the terminal
Tab completion for commands.
Hilbish has a pretty good completion system. It has a nice looking +
Tab completion for commands.
Hilbish has a pretty good completion system. It has a nice looking menu, with 2 types of menus: grid (like file completions) or list.
Like most parts of Hilbish, it’s made to be extensible and customizable. The default handler for completions in general can diff --git a/versions/doc-improvements/docs/faq/index.html b/versions/doc-improvements/docs/faq/index.html index 44a46b3..42ca896 100644 --- a/versions/doc-improvements/docs/faq/index.html +++ b/versions/doc-improvements/docs/faq/index.html @@ -5,7 +5,7 @@ Why? Hilbish emerged from the desire of a Lua configured shell." property="og:de Windows Support? It compiles for Windows (CI ensures it does), but otherwise it is not directly supported. If you’d like to improve this situation, checkout the discussion . Why? Hilbish emerged from the desire of a Lua configured shell." name=description>
Last updated Nov 12, 2023
Last updated Nov 12, 2023
No, it is not. POSIX compliance is a non-goal. Perhaps in the future, someone would be able to write a native plugin to support shell scripting (which would be against it’s main goal, but ….)
Last updated Nov 12, 2023
Hilbish has a wide range of features to enhance the user’s experience +
Last updated Nov 12, 2023
Hilbish has a wide range of features to enhance the user’s experience new ones are always being added. If there is something missing here or something you would like to see, please start a discussion or comment on any existing ones which match your request.
Last updated Nov 12, 2023
Get notified of shell actions.
Hilbish features a simple notification system which can be +
Last updated Nov 12, 2023
Get notified of shell actions.
Hilbish features a simple notification system which can be
used by other plugins and parts of the shell to notify the user
of various actions. This is used via the hilbish.message
interface.
A message
is defined as a table with the following properties:
icon
: A unicode/emoji icon for the notification.title
: The title of the messagetext
: Message text/bodychannel
: The source of the message. This should be a
unique and easily readable text identifier.summary
: A short summary of the notification and message.
diff --git a/versions/doc-improvements/docs/features/runner-mode/index.html b/versions/doc-improvements/docs/features/runner-mode/index.html
index c689385..f7215c4 100644
--- a/versions/doc-improvements/docs/features/runner-mode/index.html
+++ b/versions/doc-improvements/docs/features/runner-mode/index.html
@@ -1,7 +1,7 @@
Last updated Nov 12, 2023
Customize the interactive script/command runner.
Hilbish allows you to change how interactive text can be interpreted. +
Last updated Nov 12, 2023
Customize the interactive script/command runner.
Hilbish allows you to change how interactive text can be interpreted. This is mainly due to the fact that the default method Hilbish uses is that it runs Lua first and then falls back to shell script.
In some cases, someone might want to switch to just shell script to avoid it while interactive but still have a Lua config, or go full Lua to use diff --git a/versions/doc-improvements/docs/getting-started/index.html b/versions/doc-improvements/docs/getting-started/index.html index b20850b..02e1fad 100644 --- a/versions/doc-improvements/docs/getting-started/index.html +++ b/versions/doc-improvements/docs/getting-started/index.html @@ -3,7 +3,7 @@ Setting as Default Login shell There are a few ways to make Hilbish your default shell. A simple way is to make it your user/login shell." property="og:description">
Last updated Nov 12, 2023
To start Hilbish, open a terminal. If Hilbish has been installed and is not the +
Last updated Nov 12, 2023
To start Hilbish, open a terminal. If Hilbish has been installed and is not the
default shell, you can simply run hilbish
to start it. This will launch
a normal interactive session.
To exit, you can either run the exit
command or hit Ctrl+D.
command.preexec
-> input, cmdStr > Thrown before a command
+
command.preexec
-> input, cmdStr > Thrown before a command
is executed. The input
is the user written command, while cmdStr
is what will be executed (input
will have aliases while cmdStr
will have alias resolved input).
command.exit
-> code, cmdStr > Thrown when a command exits.
diff --git a/versions/doc-improvements/docs/hooks/hilbish/index.html b/versions/doc-improvements/docs/hooks/hilbish/index.html
index 9bb4e84..2e919cd 100644
--- a/versions/doc-improvements/docs/hooks/hilbish/index.html
+++ b/versions/doc-improvements/docs/hooks/hilbish/index.html
@@ -7,7 +7,7 @@ hilbish.vimMode -> modeName > Sent when Hilbish’s Vim mode is changed (exa
hilbish.vimAction -> actionName, args > Sent when the user does a “vim action,” being something like yanking or pasting text. See doc vim-mode actions for more info.
hilbish.cancel > Sent when the user cancels their input with Ctrl-C." name=description>
hilbish.exit
> Sent when Hilbish is about to exit.
hilbish.vimMode
-> modeName > Sent when Hilbish’s Vim mode is changed (example insert to normal mode),
+
hilbish.exit
> Sent when Hilbish is about to exit.
hilbish.vimMode
-> modeName > Sent when Hilbish’s Vim mode is changed (example insert to normal mode),
modeName
is the name of the mode changed to (can be insert
, normal
, delete
or replace
).
hilbish.vimAction
-> actionName, args > Sent when the user does a “vim action,” being something
like yanking or pasting text. See doc vim-mode actions
for more info.
hilbish.cancel
> Sent when the user cancels their input with Ctrl-C.
hilbish.notification
-> message > Sent when a message is
sent.
Hooks are Hilbish’s versions of events, which are used via the Bait module. For more detail on how to act on these hooks, you may check the Bait page.
signal.sigint
> Sent when Hilbish receives SIGINT (on Ctrl-C).
signal.resize
> Sent when the terminal is resized.
signal.sigusr1
signal.sigusr2
signal.sigint
> Sent when Hilbish receives SIGINT (on Ctrl-C).
signal.resize
> Sent when the terminal is resized.
signal.sigusr1
signal.sigusr2
Last updated Nov 12, 2023
Hilbish is a hyper-extensible shell mainly intended for interactive use. +
Last updated Nov 12, 2023
Hilbish is a hyper-extensible shell mainly intended for interactive use. To enhance the interactive experience, Hilbish comes with a wide range of features and sane defaults, including a nice looking prompt, advanced completion menus and history search.
Here documents some of the features of Hilbish and the Lua API.
Controls for background commands in Hilbish.
Hilbish has pretty standard job control. It’s missing one or two things, +
Controls for background commands in Hilbish.
Hilbish has pretty standard job control. It’s missing one or two things, but works well. One thing which is different from other shells (besides Hilbish) itself is the API for jobs, and of course it’s in Lua. You can add jobs, stop and delete (disown) them and even get output.
Lunacolors is an ANSI color/styling library for Lua. It is included +
Lunacolors is an ANSI color/styling library for Lua. It is included by default in standard Hilbish distributions to provide easy styling for things like prompts and text.
For simple usage, a single color or style is enough. For example,
you can just use lunacolors.blue 'Hello world'
and that’ll return
diff --git a/versions/doc-improvements/docs/nature/index.html b/versions/doc-improvements/docs/nature/index.html
index eda4698..11db2b5 100644
--- a/versions/doc-improvements/docs/nature/index.html
+++ b/versions/doc-improvements/docs/nature/index.html
@@ -3,7 +3,7 @@
Hilbish’s Lua core module is called nature. It’s handled after everything on the Go side initializes, which is what that first sentence was from." property="og:description">
A bit after creation, we have the outside nature. Little plants, seeds, +
A bit after creation, we have the outside nature. Little plants, seeds,
growing to their final phase: a full plant. A lot of Hilbish itself is
written in Go, but there are parts made in Lua, being most builtins
(doc
, cd
, cdr), completions, and other things.
Hilbish’s Lua core module is called nature
. It’s handled after everything
diff --git a/versions/doc-improvements/docs/vim-mode/actions/index.html b/versions/doc-improvements/docs/vim-mode/actions/index.html
index 3c0df91..892f2db 100644
--- a/versions/doc-improvements/docs/vim-mode/actions/index.html
+++ b/versions/doc-improvements/docs/vim-mode/actions/index.html
@@ -5,7 +5,7 @@ Here is documentation for what the table of args will hold for an appropriate Vi
The hilbish.vimAction hook is thrown whenever a Vim action occurs. It passes 2 arguments: the action name, and an array (table) of args relating to it.
Here is documentation for what the table of args will hold for an appropriate Vim action." name=description>
Vim actions are essentially just when a user uses a Vim keybind. +
Vim actions are essentially just when a user uses a Vim keybind. Things like yanking and pasting are Vim actions. This is not an “offical Vim thing,” just a Hilbish thing.
The hilbish.vimAction
hook is thrown whenever a Vim action occurs.
It passes 2 arguments: the action name, and an array (table) of args
diff --git a/versions/doc-improvements/docs/vim-mode/index.html b/versions/doc-improvements/docs/vim-mode/index.html
index f2c60d5..5511ae3 100644
--- a/versions/doc-improvements/docs/vim-mode/index.html
+++ b/versions/doc-improvements/docs/vim-mode/index.html
@@ -3,5 +3,5 @@
This is documentation for everything relating to it." property="og:description">
Hilbish has a Vim binding input mode accessible for use. +
Hilbish has a Vim binding input mode accessible for use.
It can be enabled with the hilbish.inputMode
function (check doc hilbish
).
This is documentation for everything relating to it.