diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index aa6998d..24aa9b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ fn main() { let prompt = prompt::Prompt::new().unwrap(); let mut cwd = std::env::current_dir().unwrap(); + let mut status = None; //: std::process::ExitStatus; // `()` can be used when no completer is required let mut rl = Editor::<()>::new(); @@ -26,6 +27,7 @@ fn main() { rl.add_history_entry(line.as_str()); let commands = parser::parse(&line); match commands[0] { + "!" => println!("{:?}", status), "cd" => match builtins::cd(&commands[1..], &prompt.home) { Ok(p) => cwd = p, Err(e) => eprintln!("Error: {}", e), @@ -33,9 +35,13 @@ fn main() { "exit" => { break 'repl; } - _ => { - builtins::run(commands[0], &commands[1..]); - } + _ => match builtins::run(commands[0], &commands[1..]) { + Ok(s) => { + println!("Ok({})", s); + status = Some(s); + }, + Err(e) => println!("Err({})", e), + }, } //println!("Line: {}", line); } |