Commit a8a49548 authored by MovingtoMars's avatar MovingtoMars

remove examples directory

parent 888194dc
......@@ -37,5 +37,7 @@ fn main() {
}
```
**See src/main.rs for a more sophisticated example.**
## License
MIT licensed. See the `LICENSE` file.
extern crate liner;
use liner::Context;
use liner::KeyBindings;
use std::io::ErrorKind;
fn main() {
let mut con = Context::new();
loop {
let res = con.read_line("[prompt]$ ", &mut |_| {});
match res {
Ok(res) => {
match res.as_str() {
"emacs" => {
con.key_bindings = KeyBindings::Emacs;
println!("emacs mode");
}
"vi" => {
con.key_bindings = KeyBindings::Vi;
println!("vi mode");
}
"exit" => {
println!("exiting...");
break;
}
_ => {}
}
con.history.push(res.into()).unwrap();
}
Err(e) => {
match e.kind() {
// ctrl-c pressed
ErrorKind::Interrupted => {}
// ctrl-d pressed
ErrorKind::UnexpectedEof => {
println!("exiting...");
break;
}
_ => panic!("error: {:?}", e),
}
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment