This repository was archived by the owner on Feb 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Eric Idogun edited this page Mar 24, 2025
·
3 revisions
Welcome to the Crash Shell Wiki โ a detailed guide to understanding, using, and extending your Rust-based modular shell. This is your go-to documentation for development, architecture, feature behavior, and contribution.
Crash Shell is a minimalist Unix-like shell written in Rust. It supports command execution, built-in commands like cd, pwd, and export, and offers an interactive prompt with command history via rustyline.
Crash Shell follows a clean, modular structure:
src/
โโโ shell/
โ โโโ mod.rs # Shell runner and coordinator
โ โโโ builtins.rs # Built-in command logic
โ โโโ interface.rs # User prompt + command history (rustyline)
โ โโโ state.rs # Shell state (cwd, previous dir, env)
โโโ command/
โ โโโ parser.rs # Tokenizes and interprets input
โ โโโ executor.rs # Runs external commands via std::process
โโโ utils.rs # Variable and tilde expansion
โโโ main.rs # Entry point
Crash Shell includes essential built-ins handled directly in builtins.rs:
| Command | Description |
|---|---|
cd [path] |
Change current directory |
cd - |
Switch to previous directory |
pwd |
Print current working directory |
export VAR=value |
Set environment variable in the current shell |
exit |
Exit the shell |
Crash Shell supports:
-
~expansion to home directory -
$VARand${VAR}lookup viastd::env -
export VAR=valueto define runtime env vars
Expansion happens in utils.rs and is automatically applied to arguments during parsing.
- Powered by
rustyline - Arrow key navigation for history (
โ/โ) - History saved to
.crash_history - Prompt is built dynamically using the current working directory
Feature ideas under consideration or development:
| Feature | Description |
|---|---|
alias |
Define shortcut names for command strings |
| Redirection | Handle >, >>, < for file IO |
| Piping | Connect commands with ` |
| Background Jobs | Run commands with &
|
| Config File | Support ~/.crashrc to load aliases/env on start |
| Tab Completion | Autocomplete commands, paths, variables |
- You can run the shell with
cargo run - The main input loop is in
shell/mod.rs - Built-ins are matched by name in
builtins.rs - Any unrecognized command is passed to the system via
executor.rs
- Open
shell/builtins.rs - Add a new match arm in
handle_builtin():
"mycommand" => {
// your logic here
true
}- Update the README and wiki (here) if it's user-facing.
Happy hacking! ๐๐