command : match plus lisible dans l'implémentation de Builtin
This commit is contained in:
parent
142d7211bc
commit
85a8aa40b4
1 changed files with 7 additions and 2 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue