rustyline 0.2.0

Rustyline, a readline implementation based on Antirez's Linenoise
docs.rs failed to build rustyline-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: rustyline-14.0.0

RustyLine

Build Status

Readline implementation in Rust that is based on Antirez' Linenoise

Documentation

Build

This project uses Cargo and Rust Nightly

cargo build --release

Example

extern crate rustyline;

use rustyline::error::ReadlineError;
use rustyline::Editor;

fn main() {
    let mut rl = Editor::new();
    if let Err(_) = rl.load_history("history.txt") {
        println!("No previous history.");
    }
    loop {
        let readline = rl.readline(">> ");
        match readline {
            Ok(line) => {
                rl.add_history_entry(&line);
                println!("Line: {}", line);
            },
            Err(ReadlineError::Interrupted) => {
                println!("CTRL-C");
                break
            },
            Err(ReadlineError::Eof) => {
                println!("CTRL-D");
                break
            },
            Err(err) => {
                println!("Error: {:?}", err);
                break
            }
        }
    }
    rl.save_history("history.txt").unwrap();
}

crates.io

You can use this package in your project by adding the following to your Cargo.toml:

[dependencies]
rustyline = "0.1.0"

Features

ToDo

  • Kill ring (Killing Commands)
  • Word commands
  • Multi line mode
  • expose an API callable from C