████████████████████████████████████████████████████████████████████████
█ █
█ ████████╗██████╗ ██╗ ██╗███████╗██╗ ██╗███████╗██╗ ██╗ █
█ ╚══██╔══╝██╔══██╗██║ ██║██╔════╝██║ ██║██╔════╝██║ ██║ █
█ ██║ ██████╔╝██║ ██║███████╗███████║█████╗ ██║ ██║ █
█ ██║ ██╔══██╗██║ ██║╚════██║██╔══██║██╔══╝ ██║ ██║ █
█ ██║ ██║ ██║╚██████╔╝███████║██║ ██║███████╗███████╗███████╗ █
█ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ █
█ █
█ █
█ The Next-Generation Shell █
█ Built in Rust for Performance █
█ █
████████████████████████████████████████████████████████████████████████
A general-purpose shell written in Rust. Like Bash and Zsh, but with modern syntax and task management baked in.
Status: Alpha (actively developing)
$ git clone https://github.com/TruFoundation/TruShell.git
$ cd TruShell
$ cargo build --release
$ ./target/release/trushellOr run directly:
$ cargo runWelcome to TruShell Native Engine
trushell> pwd
/home/user/projects
trushell> ls -la
total 48
drwxr-xr-x 5 user staff 160 Jul 5 12:34 .
-rw-r--r-- 1 user staff 1234 Jul 05 12:30 README.md
trushell> let x = 42
trushell> let result = $x * 2TruShell is a modern shell that:
- Runs standard Unix commands: ls, cat, grep, cd, etc.
- Understands expressions: arithmetic, variables, comparisons
- Chains operations: pipes, redirects, filters
- Manages tasks: integrate time tracking and task management (coming soon)
- Written in Rust: fast, safe, and reliable
Think of it as Bash meets a modern expression language. You get the power of the shell with cleaner, more intuitive syntax.
Just like your favorite shell, TruShell reads input, evaluates it, prints output, and loops:
trushell> echo "Hello, World!"
Hello, World!
trushell> exit
Goodbye!# Declare variables with 'let'
trushell> let name = "Alice"
trushell> let age = 30
# Use variables with $
trushell> let next_year_age = $age + 1
# Arithmetic
trushell> let sum = 10 + 5
trushell> let product = 3 * 7trushell> let is_adult = $age > 18
trushell> let is_match = "hello" == "hello"
trushell> let not_empty = "text" != ""# Numbers can have units for readability
trushell> let file_size = 1mb
trushell> let timeout = 500ms# Chain commands with pipes
trushell> cat data.txt | grep "error"
# Redirect output to files
trushell> echo "Hello" > greeting.txt
trushell> echo "World" >> greeting.txt
# Redirect stdin
trushell> cat < input.txt > output.txt
# Combine stdout and stderr
trushell> command &> log.txt# Group statements in blocks
trushell> let data = { let x = 5; let y = 10; $x + $y }TruShell uses a classic interpreter pipeline:
┌─────────────────────────────────────────┐
│ User Input (REPL) │
├─────────────────────────────────────────┤
│ Lexer: Convert text -> tokens │
├─────────────────────────────────────────┤
│ Parser: Convert tokens -> AST │
├─────────────────────────────────────────┤
│ Executor: Run AST or fallback to shell │
├─────────────────────────────────────────┤
│ Output / Side Effects │
└─────────────────────────────────────────┘
Tokenize:
[let, x, =, 5, +, 3]
Parse:
Let {
name: "x",
value: BinaryOp {
left: 5,
op: Add,
right: 3
}
}
Execute:
Variable x is now 8
| Command | Syntax | Description |
|---|---|---|
| let | let name = expression | Declare a variable |
| exit | exit | Leave the shell (or Ctrl+D) |
| cd | cd path | Change directory |
Arithmetic:
- '+' Add
- '-' Subtract
- '*' Multiply
- '/' Divide
Comparison:
- '>' Greater than
- '<' Less than
- '>=' Greater or equal
- '<=' Less or equal
- '==' Equal
- '!=' Not equal
Input/Output:
- '|' Pipe output to next command
- '>' Write to file (overwrite)
- '>>' Append to file
- '<' Read from file
- '&>' Redirect stderr and stdout
trushell> cd /tmp
trushell> pwd
/tmp
trushell> cd ~
trushell> pwd
/home/usertrushell> ls -la
trushell> cat README.md | head -20
trushell> grep "error" *.log > errors.txt
trushell> cp file.txt backup.txttrushell> let bytes = 1024
trushell> let kilobytes = $bytes / 1024
trushell> let total = 10 + 20 + 30 + 40trushell> let threshold = 100
trushell> let value = 150
trushell> let exceeds = $value > $threshold
# exceeds is now truetrushell> let x = 10
trushell> let y = 20
trushell> let z = $x + $y * 2
# z is 50 (multiplication happens first)
trushell> let result = ($x + $y) * 2
# result is 60TruShell recognizes the following token types:
| Token Class | Examples | Purpose |
|---|---|---|
| Keywords | let, true, false | Language control |
| Identifiers | x, $var, _private | Variable and function names |
| Numbers | 42, 3mb, 100kb | Numeric literals with optional units |
| Strings | "hello" | Quoted string literals |
| Flags | -la, --verbose, --help | Command-line flags |
| Operators | +, -, *, /, >, <, ==, != | Binary operations |
| Delimiters | (), {}, [], ., ,, ; | Structure and grouping |
| Pipes | | | Pipeline sequencing |
TruShell supports the following literal types:
Number - Integer values, optionally with units (42, 1mb, 500ms)
String - Double-quoted text literals ("text")
Boolean - true or false values
Operators are evaluated in this order (lowest to highest):
- Comparison Operators (>, <, >=, <=, ==, !=)
- Term Operators (+, -)
- Factor Operators (*, /)
- Primary (Literals, Identifiers, Parentheses, Blocks)
Variables are declared with 'let' and referenced with '$':
trushell> let count = 10
trushell> let doubled = $count * 2TruShell/
├── src/
│ ├── main.rs - REPL and command execution
│ └── parser.rs - Lexer and parser
├── Cargo.toml - Project manifest
├── Cargo.lock - Dependency lock file
└── README.md - This file
User Input String
↓
Lexer::tokenize()
↓
Token Vector
↓
Parser::parse_statement()
↓
ASTNode (Abstract Syntax Tree)
↓
Execution logic
↓
Output/Side Effects
- Separation of Concerns: Lexing, parsing, and execution are distinct phases
- Error Resilience: Parse failures trigger fallback to system command execution
- Minimal Dependencies: Uses only crossterm for terminal handling
- Extensibility: AST-based design allows easy addition of new expression types
When you enter a command, TruShell:
- Reads the input line
- Checks for special commands (exit, cd)
- Attempts to parse it
- If parse succeeds, checks if it's a recognized pattern
- If not recognized, falls back to executing as a system command
exit - Terminates the shell gracefully
cd path - Changes the current directory (handled specially, not as a subprocess)
If parsing fails, TruShell executes the input as a system command. This means most Unix commands work transparently:
trushell> grep pattern file.txt
trushell> find . -name "*.rs"
trushell> ps aux | lessTruShell supports shell-style redirection:
- 'cmd > file' writes stdout to a file
- 'cmd >> file' appends stdout to a file
- 'cmd < file' reads stdin from a file
- 'cmd &> file' redirects stderr to the same target file
- 'cmd | other > file' pipes data into a redirected final stage
This integration keeps parsed AST behavior aligned with traditional shell semantics.
- Rust 1.70 or later (Edition 2021)
- Cargo (comes with Rust)
Debug build:
$ cargo buildRelease build (optimized):
$ cargo build --releaseRun tests:
$ cargo testRun with debugging:
$ RUST_BACKTRACE=1 cargo run- Use 'cargo fmt' for formatting
- Run 'cargo clippy' to catch common mistakes
- Add unit tests for new features
- Update docs if behavior changes
We welcome contributions! Here's how to help:
- Fork the repo
- Create a feature branch: git checkout -b feature/awesome-feature
- Make your changes and write tests
- Commit with clear messages: git commit -m "Add awesome feature"
- Push: git push origin feature/awesome-feature
- Open a Pull Request and describe what you did
We are actively developing TruShell. Planned features:
- Task Management: task create, task list, task complete
- Time Tracking: time start, time stop, time log
- Persistence: SQLite backend for tasks
- Configuration: .trushellrc config file
- Custom Functions: Define and reuse scripts
- History and Completion: Arrow keys for recall, tab completion
- Shell Integration: Load in .bashrc / .zshrc
Got questions? Ideas? Bug reports?
- Open an Issue on GitHub
- Start a Discussion if you want to chat
- Check existing issues for answers
TruShell is released under the terms in LICENSE.md.
See LICENSE.md for full details.
Made with care by TruFoundation
Empowering productivity through open-source tooling.