diff --git a/src/elements/command/if.rs b/src/elements/command/if.rs index b552745b..e0d629b9 100644 --- a/src/elements/command/if.rs +++ b/src/elements/command/if.rs @@ -45,33 +45,36 @@ impl IfCommand { } } - fn eat_script(word: &str, feeder: &mut Feeder, ans: &mut IfCommand, core: &mut ShellCore) -> bool { - let mut s = None; - if command::eat_inner_script(feeder, core, word, Self::end_words(word), &mut s) { - ans.text.push_str(word); - ans.text.push_str(&s.as_mut().unwrap().get_text()); - - match word { - "if" | "elif" => ans.if_elif_scripts.push(s.unwrap()), - "then" => ans.then_scripts.push(s.unwrap()), - "else" => ans.else_script = s, - _ => panic!("SUSH INTERNAL ERROR (if parse error)"), - }; + fn set_script(word: &str, ans: &mut IfCommand, script: Option