command : match plus lisible dans l'implémentation de Builtin

This commit is contained in:
Ahurac 2024-04-14 18:48:35 +02:00
parent 142d7211bc
commit 85a8aa40b4

View file

@ -24,9 +24,14 @@ impl Builtin {
let mut args = argv.clone(); let mut args = argv.clone();
let program = args.remove(0); let program = args.remove(0);
if program == "cd" { let function = match program.as_str() {
"cd" => Some(builtins::cd),
_ => None,
};
if function.is_some() {
Ok(Self { Ok(Self {
function: builtins::cd, function: function.unwrap(),
args, args,
}) })
} else { } else {