Skip to main content

Module core

Module core 

Source
Expand description

The shared shell execution core. The shared shell execution core.

The Shell layer is split into a shared core and per-shell shells:

ShellCore — session state, execution machinery, expansion, resolution
    ├── Bash — bash grammar, bash builtins, bash dialect
    └── Zsh  — zsh grammar (sh-family subset today), zsh builtins, zsh dialect

The core owns what the shell layer as a whole owns — the session’s working directory, environment, history, aliases, functions, the command runtime, word expansion, globbing, redirection, and resolution (alias → function → builtin → external). It is deliberately language-agnostic about semantics: the grammar is parsed by each shell, and builtins are dispatched through a per-shell crate::core::ShellDialect, so a builtin named echo may (and does) behave differently in Bash than in Zsh. Mechanisms the shells verified to share (for example cd) live here as core methods that a shell’s table may delegate to; everything else is implemented in the shell’s own module.

The grammar today: both shells parse through brush_parser (the sh-family grammar) — this is a shared substrate, not a Bash-ism. Zsh owns any future zsh-specific grammar on top of this core.

Structs§

NameResolution
How a name resolves in the shell: the shared precedence walk behind type, which, where, and whence. Each shell’s reporter owns the phrasing; this owns the order (alias → function → builtin → PATH).
ShellCore
The shared session state and execution machinery.
ShellDialect
The per-shell behavior the core depends on: identity, messages, and the builtin table. Each shell constructs its own dialect.

Functions§

format_login_line
Formats a virtual timestamp as a Unix-style “Last login” line, for example Fri Aug 21 01:16:56 (the macOS convention: weekday, month, day, and clock time, with no year).
hostname_from_etc
The virtual host name, read from /etc/hostname as root.
needs_continuation
Returns true when input is an incomplete shell construct that needs more input before it can be executed: an open quote, an unterminated here document, or an unfinished compound command.

Type Aliases§

BuiltinRunner
How the core dispatches builtins for one shell language.