diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index f78e54d..1ff551c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,6 +57,25 @@ fn eval(paths: &[&str], prompt: &str) { } } + // Check if user wants to change directories + if cmd == "cd" { + let path = match args.first() { + Some(str) => str, + None => { + println!("cd: Must specify a path"); + continue; + } + }; + match std::env::set_current_dir(path) { + Ok(_) => {} + Err(_) => { + println!("cd: Unable to change into {}", path); + continue; + } + } + continue; + } + // Check if the command exists let cmd = match bins.iter().find(|b| b.split("/").last().unwrap() == cmd) { Some(cmd) => cmd, |