diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-09 23:26:02 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-09 23:26:02 -0500 |
commit | d67d7cda39f5c3a84ee030778d69cdf08634a33c (patch) | |
tree | 8f99f1e559201ee8bb70787b13d514c7ba15c13c /src/runner/builtins/command.rs | |
parent | cba518546d09e9a716c9230ace1bbadd1c14fc2d (diff) | |
download | nbsh-d67d7cda39f5c3a84ee030778d69cdf08634a33c.tar.gz nbsh-d67d7cda39f5c3a84ee030778d69cdf08634a33c.zip |
fix builtins wrapping builtins
Diffstat (limited to 'src/runner/builtins/command.rs')
-rw-r--r-- | src/runner/builtins/command.rs | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/src/runner/builtins/command.rs b/src/runner/builtins/command.rs index 2c1f755..7d84c8f 100644 --- a/src/runner/builtins/command.rs +++ b/src/runner/builtins/command.rs @@ -9,23 +9,7 @@ pub struct Command { } impl Command { - pub fn new(exe: crate::parse::Exe) -> Result<Self, crate::parse::Exe> { - if let Some(s) = exe.exe().to_str() { - if let Some(f) = super::BUILTINS.get(s) { - Ok(Self { - exe, - f, - cfg: Cfg::new(), - }) - } else { - Err(exe) - } - } else { - Err(exe) - } - } - - pub fn new_with_io( + pub fn new( exe: crate::parse::Exe, io: Io, ) -> Result<Self, crate::parse::Exe> { @@ -34,7 +18,7 @@ impl Command { Ok(Self { exe, f, - cfg: Cfg::new_with_io(io), + cfg: Cfg::new(io), }) } else { Err(exe) @@ -83,14 +67,7 @@ pub struct Cfg { } impl Cfg { - fn new() -> Self { - Self { - io: Io::new(), - pre_exec: None, - } - } - - fn new_with_io(io: Io) -> Self { + fn new(io: Io) -> Self { Self { io, pre_exec: None } } |