| Crates.io | shelgon |
| lib.rs | shelgon |
| version | 0.2.2 |
| created_at | 2025-02-13 22:08:18.367863+00 |
| updated_at | 2025-08-22 00:53:14.249764+00 |
| description | A robust framework for building interactive REPL applications and custom shells in Rust |
| homepage | https://github.com/nishantjoshi00/shelgon |
| repository | https://github.com/nishantjoshi00/shelgon |
| max_upload_size | |
| id | 1555004 |
| size | 61,611 |

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.
Add Shelgon to your Cargo.toml:
[dependencies]
shelgon = "0.1.0"
tokio = { version = "1.43.0", features = ["full"] }
anyhow = "1.0.95"
Create a simple echo shell:
use shelgon::{command, renderer};
struct EchoExecutor {}
impl command::New for EchoExecutor {
fn new() -> anyhow::Result<(Self, ())> {
Ok((Self {}, ()))
}
}
impl command::Execute for EchoExecutor {
type Context = ();
fn prompt(&self, _: &Self::Context) -> String {
"$".to_string()
}
fn execute(
&self,
_: &mut Self::Context,
cmd: command::CommandInput,
) -> anyhow::Result<command::OutputAction> {
Ok(command::OutputAction::Command(command::CommandOutput {
prompt: cmd.prompt,
command: cmd.command.clone(),
stdin: cmd.stdin.unwrap_or_default(),
stdout: vec![cmd.command],
stderr: Vec::new(),
}))
}
}
fn main() -> anyhow::Result<()> {
let rt = tokio::runtime::Runtime::new()?;
let app = renderer::App::<EchoExecutor>::new(rt)?;
app.execute()
}

Here's how to build a dragon-like shell with shelgon:
command::Executeexecute methodcompletion method for smart suggestionsprepare method to indicate which commands need inputCheck out the examples directory for more advanced usage patterns, including:
echosh.rs: A basic echo shell demonstrating core functionalityContributions are welcome! Please feel free to submit a Pull Request. Before contributing, please:
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Built by Human, Documented by LLM.