2 extern crate lazy_static;
4 extern crate itertools;
7 extern crate rustyline;
8 use rustyline::error::ReadlineError;
14 use types::{format_error};
17 // TODO: figure out a way to avoid including env
22 // `()` can be used when no completer is required
23 let mut rl = Editor::<()>::new();
24 if rl.load_history(".mal-history").is_err() {
25 eprintln!("No previous history.");
29 let readline = rl.readline("user> ");
32 rl.add_history_entry(&line);
33 rl.save_history(".mal-history").unwrap();
35 match reader::read_str(line) {
37 println!("{}", mv.pr_str(true));
39 Err(e) => println!("Error: {}", format_error(e)),
43 Err(ReadlineError::Interrupted) => continue,
44 Err(ReadlineError::Eof) => break,
46 println!("Error: {:?}", err);
53 // vim: ts=2:sw=2:expandtab