Expand description
Implementation of the shell built-in utilities.
Each built-in utility is implemented in the submodule named after the
utility. The submodule contains the main function that implements the
built-in utility. The submodule many also export other items that are used
by the main function. The module documentation for each submodule
describes the specification of the built-in utility.
The common module provides common functions that are used for
implementing built-in utilities.
§Stack
Many built-ins in this crate use Stack::current_builtin to obtain the
command word that invoked the built-in. It is used to report the command
location in error messages, switch the behavior of the built-in depending on
the command, etc. For the built-ins to work correctly, the
stack should contain a built-in frame so
that Stack::current_builtin provides the correct command word.
§Dependencies to be injected
Some built-ins in this crate require certain dependencies to be injected
into the environment’s any storage. If these
dependencies are not injected, the built-in may panic at runtime.
- The
commandbuilt-in requires aRunFunctioninstance to invoke shell functions, and anIsKeywordinstance to check for reserved words. - The
evalandsourcebuilt-ins require aRunReadEvalLoopinstance to run the read-eval loop for executing commands. - The
readbuilt-in requires aGetPromptinstance to generate prompts when reading input. - The
waitbuilt-in requires aRunSignalTrapIfCaughtinstance to handle trapped signals while waiting for jobs.
Re-exports§
pub use yash_env::builtin::*;
Modules§
- alias
- Alias built-in.
- bg
- Bg built-in
- break
- Break built-in
- cd
- Cd built-in
- colon
- Colon (
:) built-in - command
- Command built-in
- common
- Common items for implementing built-ins
- continue
- Continue built-in
- eval
- Eval built-in
- exec
- Exec built-in
- exit
- Exit built-in
- export
- Export built-in
- false
- False built-in
- fg
- Fg built-in
- getopts
- Getopts built-in
- jobs
- Jobs built-in
- kill
- Kill built-in
- pwd
- Pwd built-in.
- read
- Read built-in
- readonly
- Readonly built-in.
- return
- Return built-in.
- set
- Set built-in
- shift
- Shift built-in
- source
- Source (
.) built-in - times
- Times built-in
- trap
- Trap built-in.
- true
- True built-in
- type
- Type built-in
- typeset
- Typeset built-in
- ulimit
- Ulimit built-in
- umask
- Umask built-in
- unalias
- Unalias built-in
- unset
- Unset built-in
- wait
- Wait built-in
Constants§
- BUILTINS
- Array of all the implemented built-in utilities.