diff options
Diffstat (limited to 'src/parse')
-rw-r--r-- | src/parse/ast.rs | 13 |
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>, |