gsh
gsh is the core entry point for the Interactive Gleam Shell.
It acts as a development orchestrator, providing two main capabilities:
- Zero-Config Bootloader: Intercepts CLI arguments to dynamically boot host
applications in the background (e.g.,
gleam run -m gsh -- my_app). - Persistent REPL: A live-node interactive shell that maintains VM state, memoizes side effects, and safely handles runtime exceptions while toggling terminal raw mode to ensure clean I/O.
Types
Holds the persistent state of the shell session across evaluations. This state is passed recursively through the REPL loop to maintain history, variable bindings, and declared types/functions.
pub type ShellState {
ShellState(
prompt_count: Int,
bindings: List(binding.Binding),
imports: List(String),
types: List(String),
history: List(String),
functions: List(String),
)
}
Constructors
-
ShellState( prompt_count: Int, bindings: List(binding.Binding), imports: List(String), types: List(String), history: List(String), functions: List(String), )