diff --git a/README.md b/README.md index 5346536..a48e07f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ TODO: * Aliases don't currently handle arguments. My alias "vless" does not work with "vless lib.rs" * A shortcut / implemented command to show all Hotkeys * git commit -m "message" does not work -* Can't cd to a directory containing spaces in its name * Startup script section in sqishrc ## sqishrc (Config) diff --git a/src/lib.rs b/src/lib.rs index f8cc5e0..cd08408 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,9 +47,17 @@ pub mod shell { match command { "cd" => { + let args = args.collect::>(); let homedir = dirs::home_dir().unwrap().into_os_string().into_string().unwrap(); - let new_dir = args.peekable().peek().map_or(homedir.as_str(), |x| *x); - let root = Path::new(new_dir); + //let new_dir = args.peekable().peek().map_or(homedir.as_str(), |x| *x); + let mut new_dir = String::new(); + if args.len() > 0 { + *&mut new_dir = args.join(" "); + } else { + *&mut new_dir = String::from(homedir.as_str()); + } + + let root = Path::new(&new_dir); if let Err(e) = env::set_current_dir(&root) { eprintln!(" Err: {}", e); } else { @@ -237,7 +245,7 @@ pub mod shell { stdout.flush(); *current_number += 1; } else if mycommand == &String::from("exit") { - write!(stdout, "\r\n Sayonara \r\n"); + write!(stdout, "\r\nThanks for using Sqish!\r\nSayonara \r\n"); RawTerminal::suspend_raw_mode(&stdout); std::process::exit(0); } else { @@ -342,6 +350,7 @@ pub mod shell { stdout.flush(); } Key::Char('\n') => { + current_number = get_curr_history_number(); current_pos = 0; max_pos = 0; run_cmd(&mut mycommand, @@ -352,7 +361,7 @@ pub mod shell { Key::Ctrl('q'|'d') => { RawTerminal::suspend_raw_mode(&stdout); - writeln!(stdout, "\r\n Sayonara \r\n"); + writeln!(stdout, "\r\nThanks for using Sqish !\r\nSayonara \r\n"); break; },