|
|
@ -6,7 +6,6 @@ mod preprocess; |
|
|
|
mod prompt;
|
|
|
|
|
|
|
|
use crate::builtins::BuiltinConfig;
|
|
|
|
use crate::error::ShellError;
|
|
|
|
use execute::interpret;
|
|
|
|
use rustyline::config::Configurer;
|
|
|
|
use rustyline::error::ReadlineError;
|
|
|
@ -30,20 +29,7 @@ fn main() -> Result<()> { |
|
|
|
let readline = rl.readline(&prompt.get_prompt());
|
|
|
|
|
|
|
|
match readline {
|
|
|
|
Ok(line) => match interpret(line, &mut config, ctrlc_recv.clone()) {
|
|
|
|
Ok(_) => prompt.style = config.prompt_style.clone(),
|
|
|
|
Err(ShellError::EmptyLine) => continue,
|
|
|
|
Err(ShellError::NotFound(cmd)) => {
|
|
|
|
eprintln!("{}: command not found", cmd.get_program().to_string_lossy())
|
|
|
|
}
|
|
|
|
Err(ShellError::ExecuteFailure(msg)) => {
|
|
|
|
eprintln!("{}", msg)
|
|
|
|
}
|
|
|
|
Err(ShellError::MalformedArgs(args)) => {
|
|
|
|
eprintln!("Malformed arguments: {}", args)
|
|
|
|
}
|
|
|
|
Err(ShellError::Interrupt) => continue,
|
|
|
|
},
|
|
|
|
Ok(line) => interpret(line, &mut config, ctrlc_recv.clone()),
|
|
|
|
Err(ReadlineError::Interrupted) => continue,
|
|
|
|
Err(ReadlineError::Eof) => break,
|
|
|
|
Err(err) => {
|
|
|
|