Crate pomprt

source ·
Expand description

A tiny and extensible readline implementation built from scratch

Pomprt is a multi-line editor with support for things like syntax highlighting, hints and completion.

§Usage

For starters, you can create a prompt with prompt::new, and read input via Prompt::read, or by iterating through it:

for input in pomprt::new(">> ") {
    println!("{input}");
}

§Custom editors

For more complex applications, extra features can be added by implementing an Editor:

impl pomprt::Editor for MyEditor {
    // Make the prompt cyan
    fn highlight_prompt(&self, prompt: &str, _multiline: bool) -> String {
        format!("\x1b[36m{prompt}")
    }
}

let mut cmd = pomprt::with(MyEditor, "><> ");
// ...

That’s it! More complete examples can be found in the examples folder.

Re-exports§

Modules§

  • Helper module for reading and parsing ANSI sequences

Structs§

Enums§

Traits§

Functions§