From 85a8aa40b430f2d850e752ed3684772294657476 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Sun, 14 Apr 2024 18:48:35 +0200 Subject: [PATCH] =?UTF-8?q?command=20:=20match=20plus=20lisible=20dans=20l?= =?UTF-8?q?'impl=C3=A9mentation=20de=20Builtin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/command/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/command/mod.rs b/src/command/mod.rs index 07fa206..7ae6c22 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -24,9 +24,14 @@ impl Builtin { let mut args = argv.clone(); 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 { - function: builtins::cd, + function: function.unwrap(), args, }) } else {