|
@ -1,6 +1,8 @@ |
|
|
|
|
|
mod execute;
|
|
|
mod parse;
|
|
|
mod parse;
|
|
|
mod prompt;
|
|
|
mod prompt;
|
|
|
|
|
|
|
|
|
|
|
|
use execute::execute;
|
|
|
use parse::parse_line;
|
|
|
use parse::parse_line;
|
|
|
use rustyline::error::ReadlineError;
|
|
|
use rustyline::error::ReadlineError;
|
|
|
use rustyline::{Editor, Result};
|
|
|
use rustyline::{Editor, Result};
|
|
@ -17,9 +19,8 @@ fn main() -> Result<()> { |
|
|
|
|
|
|
|
|
match readline {
|
|
|
match readline {
|
|
|
Ok(line) => {
|
|
|
Ok(line) => {
|
|
|
if let Err(e) = parse_line(&line) {
|
|
|
|
|
|
println!("{}", e)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
let (command, args) = parse_line(&line);
|
|
|
|
|
|
execute(command, &args)?;
|
|
|
}
|
|
|
}
|
|
|
Err(ReadlineError::Interrupted) => {
|
|
|
Err(ReadlineError::Interrupted) => {
|
|
|
println!("CTRL-C");
|
|
|
println!("CTRL-C");
|
|
|