summaryrefslogtreecommitdiffstats
path: root/src/shell/mod.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-09 22:56:33 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-09 22:56:33 -0500
commitde77b9e370341fd2fdad06113779ef187a0f5f9d (patch)
treef68f6b01786f9d1fb06ed2d2dd3860e21a62cf02 /src/shell/mod.rs
parent3c30ee54cd8dc8c9bf43beb54ee1fe0292c07c90 (diff)
downloadnbsh-de77b9e370341fd2fdad06113779ef187a0f5f9d.tar.gz
nbsh-de77b9e370341fd2fdad06113779ef187a0f5f9d.zip
stop parsing command lines at all in the main shell process
Diffstat (limited to 'src/shell/mod.rs')
-rw-r--r--src/shell/mod.rs51
1 files changed, 14 insertions, 37 deletions
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();
}