diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 42fa2a9..f78e54d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use ctrlc; use std::fs; use std::io; use std::io::Write; @@ -78,6 +79,8 @@ fn eval(paths: &[&str], prompt: &str) { } fn main() { + // Define paths + // TODO: Hardcoded path should only be the fallback let paths = [ "/bin", "/sbin", @@ -87,7 +90,16 @@ fn main() { "/usr/local/sbin", ]; + // Set the prompt let prompt = "|> "; + // Handle signals + ctrlc::set_handler(move || { + print!("\n{}", prompt); + io::stdout().flush().unwrap(); + }) + .expect("Unable to set <C-c> handler"); + + // Begin evaluating commands eval(&paths, prompt); } |