rl-sys 0.2.2

Native bindings to libreadline.
Documentation

readline-sys

Version

Crates.io Build Status

Native bindings to libreadline.

Features

  • thin wrappers around readline and add_history
  • write history line to file: add_history_persist
  • load history from file: preload_history

Usage

Add rl-sys as a dependency in Cargo.toml

[dependencies]
rl-sys = "0.2.2"

A simple implementation of echo using rl_sys::readline

extern crate rl_sys;

fn main() {
    let prompt = String::from("$ ");
    loop {
        let response = match rl_sys::readline(prompt) {
            Ok(o) => match o {
                Some(s) => s,
                None    => break,
            },
            None    => break,
        };
        println!("{}", response);
    }
}

License

Distributed under the MIT License.