command : suppression d'un autre nombre magique

This commit is contained in:
Ahurac 2024-04-10 15:15:29 +02:00
parent 529d5fdb81
commit 557f196fe9

View file

@ -12,6 +12,10 @@ impl ExitCode {
pub fn get(&self) -> u8 { pub fn get(&self) -> u8 {
self.exit_code self.exit_code
} }
pub fn not_found() -> Self {
Self { exit_code: 127 }
}
} }
pub trait Command { pub trait Command {
@ -99,7 +103,7 @@ impl Command for UnixProgram {
} else { } else {
let message = format!("{}: command not found", &program); let message = format!("{}: command not found", &program);
error::print_error(message); error::print_error(message);
ExitCode::new(127) ExitCode::not_found()
} }
} }
} }