commit | d0a1d7597b55dc2a525e57a38f01ce5d7952269e | [log] [tgz] |
---|---|---|
author | Main <kkawa1570@gmail.com> | Sat Sep 05 19:34:38 2015 -0400 |
committer | Main <kkawa1570@gmail.com> | Sat Sep 05 19:34:38 2015 -0400 |
tree | d8723bcaa782f20df8a4b9f84fb5175fbca648a0 | |
parent | 6cf9f5a6ad66e5a8a466e3b9f11b705bd154d4b4 [diff] |
Update README.md for v0.1.0
Readline implementation in Rust that is based on Antirez' Linenoise
This project uses Cargo and Rust Stable
cargo build --release
``rust 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`: ``toml [dependencies] rustyline = "0.1.0"