From de77b9e370341fd2fdad06113779ef187a0f5f9d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 9 Jan 2022 22:56:33 -0500 Subject: stop parsing command lines at all in the main shell process --- src/shell/mod.rs | 51 ++++++++++++++------------------------------------- 1 file changed, 14 insertions(+), 37 deletions(-) (limited to 'src/shell/mod.rs') diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 4501ce9..629f482 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -320,25 +320,13 @@ impl Shell { self.readline.clear_input(); let entry = self.history.entry(idx).await; let input = entry.cmd(); - let idx = match crate::parse::ast::Commands::parse(input) - { - Ok(ast) => { - let idx = self - .history - .run(ast, &self.env, event_w.clone()) - .await - .unwrap(); - self.set_focus(Focus::History(idx), Some(entry)) - .await; - self.hide_readline = true; - idx - } - Err(e) => self - .history - .parse_error(e, &self.env, event_w.clone()) - .await - .unwrap(), - }; + let idx = self + .history + .run(input, &self.env, event_w.clone()) + .await + .unwrap(); + self.set_focus(Focus::History(idx), Some(entry)).await; + self.hide_readline = true; self.env.set_idx(idx + 1); } else { self.set_focus(Focus::Readline, None).await; @@ -439,24 +427,13 @@ impl Shell { textmode::Key::Ctrl(b'm') => { let input = self.readline.input(); if !input.is_empty() { - let idx = match crate::parse::ast::Commands::parse(input) - { - Ok(ast) => { - let idx = self - .history - .run(ast, &self.env, event_w.clone()) - .await - .unwrap(); - self.set_focus(Focus::History(idx), None).await; - self.hide_readline = true; - idx - } - Err(e) => self - .history - .parse_error(e, &self.env, event_w.clone()) - .await - .unwrap(), - }; + let idx = self + .history + .run(input, &self.env, event_w.clone()) + .await + .unwrap(); + self.set_focus(Focus::History(idx), None).await; + self.hide_readline = true; self.env.set_idx(idx + 1); self.readline.clear_input(); } -- cgit v1.2.3-54-g00ecf