Compare commits

..

1 Commits

Author SHA1 Message Date
sammyette 8935426d08
Merge 316a818c2f into a0513c0a05 2023-12-19 01:13:08 +00:00
4 changed files with 21 additions and 131 deletions

View File

@ -7,61 +7,15 @@ menu:
parent: "Signals" parent: "Signals"
--- ---
## command.preexec - `command.preexec` -> input, cmdStr > Thrown before a command
Thrown right before a command is executed. 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).
#### Variables - `command.exit` -> code, cmdStr > Thrown when a command exits.
`string` **`input`** `code` is the exit code of the command, and `cmdStr` is the command that was run.
The raw string that the user typed. This will include the text
without changes applied to it (argument substitution, alias expansion,
etc.)
`string` **`cmdStr`** - `command.not-found` -> cmdStr > Thrown when a command is not found.
The command that will be directly executed by the current runner.
<hr> - `command.not-executable` -> cmdStr > Thrown when Hilbish attempts to run a file
that is not executable.
## command.exit
Thrown after the user's ran command is finished.
#### Variables
`number` **`code`**
The exit code of what was executed.
`string` **`cmdStr`**
The command or code that was executed
<hr>
## command.not-found
Thrown if the command attempted to execute was not found.
This can be used to customize the text printed when a command is not found.
Example:
```lua
local bait = require 'bait'
-- Remove any present handlers on `command.not-found`
local notFoundHooks = bait.hooks 'command.not-found'
for _, hook in ipairs(notFoundHooks) do
bait.release('command.not-found', hook)
end
-- then assign custom
bait.catch('command.not-found', function(cmd)
print(string.format('The command "%s" was not found.', cmd))
end)
```
#### Variables
`string` **`cmdStr`**
The name of the command.
<hr>
## command.not-executable
Thrown when the user attempts to run a file that is not executable
(like a text file, or Unix binary without +x permission).
#### Variables
`string` **`cmdStr`**
The name of the command.

View File

@ -7,41 +7,15 @@ menu:
parent: "Signals" parent: "Signals"
--- ---
## hilbish.exit + `hilbish.exit` > Sent when Hilbish is about to exit.
Sent when Hilbish is going to exit.
#### Variables + `hilbish.vimMode` -> modeName > Sent when Hilbish's Vim mode is changed (example insert to normal mode),
This signal returns no variables. `modeName` is the name of the mode changed to (can be `insert`, `normal`, `delete` or `replace`).
<hr>
## hilbish.vimMode
Sent when the Vim mode of Hilbish is changed (like from insert to normal mode).
This can be used to change the prompt and notify based on Vim mode.
#### Variables
`string` **`modeName`**
The mode that has been set.
Can be these values: `insert`, `normal`, `delete` or `replace`
<hr>
## hilbish.cancel
Sent when the user cancels their command input with Ctrl-C
#### Variables
This signal returns no variables.
<hr>
## hilbish.notification
Thrown when a [notification](../../features/notifications) is sent.
#### Variables
`table` **`notification`**
The notification. The properties are defined in the link above.
<hr>
+ `hilbish.vimAction` -> actionName, args > Sent when the user does a "vim action," being something + `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. 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.

View File

@ -7,34 +7,10 @@ menu:
parent: "Signals" parent: "Signals"
--- ---
## signal.sigint + `signal.sigint` > Sent when Hilbish receives SIGINT (on Ctrl-C).
Thrown when Hilbish receive the SIGINT signal,
aka when Ctrl-C is pressed.
#### Variables + `signal.resize` > Sent when the terminal is resized.
This signal returns no variables.
<hr> + `signal.sigusr1`
## signal.resize
Thrown when the terminal is resized.
#### Variables
This signal returns no variables.
<hr>
## signal.sigusr1
Thrown when SIGUSR1 is sent to Hilbish.
#### Variables
This signal returns no variables.
<hr>
## signal.sigusr2
Thrown when SIGUSR2 is sent to Hilbish.
#### Variables
This signal returns no variables.
+ `signal.sigusr2`

View File

@ -1,14 +0,0 @@
// +build pprof
package main
import (
_ "net/http/pprof"
"net/http"
)
func init() {
go func() {
http.ListenAndServe("localhost:8080", nil)
}()
}