From 3c478958c77eb00367513b21200d432333a887aa Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 7 Mar 2022 01:54:56 -0500 Subject: basic implementation of aliases --- src/parse/mod.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/parse/mod.rs') diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 9663086..e2b7ec0 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -11,7 +11,7 @@ impl Pipeline { } } -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct Exe { exe: std::path::PathBuf, args: Vec, @@ -27,6 +27,16 @@ impl Exe { &self.args } + pub fn append(&mut self, other: Self) { + let Self { + exe: _exe, + args, + redirects, + } = other; + self.args.extend(args); + self.redirects.extend(redirects); + } + pub fn redirects(&self) -> &[Redirect] { &self.redirects } @@ -107,10 +117,7 @@ pub struct Error { impl Error { fn new(input: String, e: pest::error::Error) -> Self { - Self { - input, - e, - } + Self { input, e } } } -- cgit v1.2.3-54-g00ecf