rusty_repl 0.1.0

REPL library with customisable prompts and clean terminal management.
Documentation

๐Ÿฆ€ rusty_repl

A lightweight, modular framework for building interactive REPLs in Rust โ€” with clean prompts, terminal isolation, and customizable input handling.


โœจ Features

  • ๐Ÿ–ฅ๏ธ Alternate screen mode โ€” clean, isolated terminal workspace
  • ๐Ÿ’ฌ Custom prompts โ€” easily define your own Prompt style
  • โšก Input handling loop โ€” powered by reedline
  • ๐Ÿงน Automatic cleanup โ€” restores cursor, title, and screen on exit
  • ๐ŸŽจ Extensible design โ€” plug in custom keyword highlighters or prompt logic

๐Ÿš€ Quick Start

Add to your Cargo.toml:

[dependencies]
rusty_repl = "0.1.0"

Then in your project:

use rusty_repl::Repl;

fn handle_input(line: String) -> bool {
    if line.trim() == "exit" {
        return true;
    }
    println!("You typed: {line}");
    false
}

fn main() -> std::io::Result<()> {
    let repl = Repl::new("Demo REPL", None);
    repl.run(handle_input)
}

This opens an alternate terminal screen with a minimal prompt.

Type exit to leave the session.

๐Ÿงฉ Architecture

Module Responsibility
repl::input Handles user input with reedline
repl::output Manages terminal (alternate screen, cursor, cleanup)
repl::prompt Defines a cleaner, customizable prompt
repl::manager Connects all components into a cohesive REPL session

Top-level entrypoint:

use rusty_repl::Repl;

๐Ÿ”ง Future Enhancements

  • ๐Ÿ” Keyword highlighting with configurable colors
  • ๐Ÿ’พ Persistent command history
  • ๐Ÿง  Syntax-aware input completion

๐Ÿ“œ License

Licensed under the MIT License