|
@ -1,3 +1,30 @@ |
|
|
fn main() {
|
|
|
|
|
|
println!("Hello, world!");
|
|
|
|
|
|
|
|
|
use rustyline::error::ReadlineError;
|
|
|
|
|
|
use rustyline::{Editor, Result};
|
|
|
|
|
|
|
|
|
|
|
|
fn main() -> Result<()> {
|
|
|
|
|
|
let mut rl = Editor::<()>::new()?;
|
|
|
|
|
|
|
|
|
|
|
|
loop {
|
|
|
|
|
|
let readline = rl.readline("» ");
|
|
|
|
|
|
|
|
|
|
|
|
match readline {
|
|
|
|
|
|
Ok(line) => {
|
|
|
|
|
|
println!("Line: {}", line);
|
|
|
|
|
|
},
|
|
|
|
|
|
Err(ReadlineError::Interrupted) => {
|
|
|
|
|
|
println!("CTRL-C");
|
|
|
|
|
|
break
|
|
|
|
|
|
},
|
|
|
|
|
|
Err(ReadlineError::Eof) => {
|
|
|
|
|
|
println!("CTRL-D");
|
|
|
|
|
|
break
|
|
|
|
|
|
},
|
|
|
|
|
|
Err(err) => {
|
|
|
|
|
|
println!("Error: {:?}", err);
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
}
|
|
|
}
|