Shelgon
Shelgon is a robust Rust framework for building interactive REPL (Read-Eval-Print Loop) applications and custom shells. It provides a flexible, type-safe foundation with built-in terminal UI capabilities using ratatui.
Features
- 🛡️ Type-safe Command Execution - Like Shelgon's protective shell, your commands are wrapped in a type-safe interface
- 🔄 Async Runtime Integration - Built on tokio for high-performance async operations
- 🎨 Beautiful TUI - Powered by ratatui with support for styling and colors
- ⌨️ Rich Input Handling - Complete keyboard interaction support including:
- Command history
- Cursor movement
- Tab completion
- Ctrl+C/Ctrl+D handling
- 📝 Custom Context Support - Maintain state between commands with your own context type
- 📥 STDIN Support - Handle multi-line input for commands that need it
Installation
Add Shelgon to your Cargo.toml:
[]
= "0.1.0"
= { = "1.43.0", = ["full"] }
= "1.0.95"
Quick Start
Create a simple echo shell:
use ;
Evolution Guide: Building Your Own Shell
Here's how to build a dragon-like shell with shelgon:
- Define Your Executor: Create a type that implements
command::Execute - Create Your Context: Design a context type to maintain state between commands
- Implement Command Logic: Add your command execution logic in the
executemethod - Add Tab Completion: Implement the
completionmethod for smart suggestions - Handle STDIN: Use the
preparemethod to indicate which commands need input
Examples
Check out the examples directory for more advanced usage patterns, including:
echosh.rs: A basic echo shell demonstrating core functionality
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. Before contributing, please:
- Check existing issues or create a new one
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Built by Human, Documented by LLM.