Fixed bug on incorrect command, missing carriage return on cd

This commit is contained in:
Justine 2023-03-04 19:56:50 +01:00
parent 522b8e7037
commit 5743678e23

View File

@ -127,12 +127,16 @@ pub mod shell {
return Err(CmdOutput::from_values(format!("Could not parse command {:?}", e), -1)); return Err(CmdOutput::from_values(format!("Could not parse command {:?}", e), -1));
}, },
}; };
if parts.len() < 1 {
return Err(CmdOutput::from_values(String::from("Could not parse command"), -1));
}
let command = parts[0].as_str(); let command = parts[0].as_str();
let args = Vec::from(&parts[1..]); let args = Vec::from(&parts[1..]);
match command { match command {
"cd" => { "cd" => {
change_dir(&args, &mut previous_command)?; change_dir(&args, &mut previous_command)?;
print!("\r\n");
}, },
"history" => { "history" => {
let next = commands.peek().is_some(); let next = commands.peek().is_some();