Thrown right before a command is executed.
string
input
The raw string that the user typed. This will include the text
without changes applied to it (argument substitution, alias expansion,
etc.)
string
cmdStr
The command that will be directly executed by the current runner.
Thrown after the user’s ran command is finished.
number
code
The exit code of what was executed.
string
cmdStr
The command or code that was executed
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:
1local bait = require 'bait'
2-- Remove any present handlers on `command.not-found`
3
4local notFoundHooks = bait.hooks 'command.not-found'
5for _, hook in ipairs(notFoundHooks) do
6 bait.release('command.not-found', hook)
7end
8
9-- then assign custom
10bait.catch('command.not-found', function(cmd)
11 print(string.format('The command "%s" was not found.', cmd))
12end)
string
cmdStr
The name of the command.
Thrown when the user attempts to run a file that is not executable (like a text file, or Unix binary without +x permission).
string
cmdStr
The name of the command.
Want to help improve this page? Create an issue.