summaryrefslogtreecommitdiffstats
path: root/src/parse/ast.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-09 18:03:32 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-09 18:03:32 -0500
commit7f2a0f4f3f232763822734562e2f44892ed31d1c (patch)
tree0dbacfc0cb24ab77d6229ccc7938981985f8f650 /src/parse/ast.rs
parent27ad465ce178aa9bc51d2bea2b5c5c1a77089138 (diff)
downloadnbsh-7f2a0f4f3f232763822734562e2f44892ed31d1c.tar.gz
nbsh-7f2a0f4f3f232763822734562e2f44892ed31d1c.zip
extend the session leader process to be able to run full command lines
Diffstat (limited to 'src/parse/ast.rs')
-rw-r--r--src/parse/ast.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs
index d71f6a3..3008ef9 100644
--- a/src/parse/ast.rs
+++ b/src/parse/ast.rs
@@ -86,22 +86,13 @@ impl Command {
}
}
-#[derive(Debug, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Pipeline {
exes: Vec<Exe>,
input_string: String,
}
impl Pipeline {
- pub fn parse(pipeline: &str) -> Result<Self, super::Error> {
- Ok(Self::build_ast(
- Shell::parse(Rule::pipeline, pipeline)
- .map_err(|e| super::Error::new(pipeline, anyhow::anyhow!(e)))?
- .next()
- .unwrap(),
- ))
- }
-
pub fn eval(self, env: &Env) -> super::Pipeline {
super::Pipeline {
exes: self.exes.into_iter().map(|exe| exe.eval(env)).collect(),
@@ -122,7 +113,7 @@ impl Pipeline {
}
}
-#[derive(Debug, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
struct Exe {
exe: Word,
args: Vec<Word>,