builtins : code de cd plus lisible

This commit is contained in:
Ahurac 2024-04-18 10:32:28 +02:00
parent d162a24db0
commit 2337bd3127

View file

@ -17,7 +17,7 @@ pub(super) fn cd(args: &Vec<String>) -> ExitCode {
};
}
let exit_code: ExitCode;
let mut exit_code = ExitCode::success();
if path.is_some() {
let path = path.unwrap();
let result = set_current_dir(&path);
@ -26,11 +26,7 @@ pub(super) fn cd(args: &Vec<String>) -> ExitCode {
let error = CdError::new(&args[0]);
error::print(Box::new(error));
exit_code = ExitCode::new(2);
} else {
exit_code = ExitCode::success();
}
} else {
exit_code = ExitCode::success();
}
exit_code