You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
632 B
28 lines
632 B
use super::expression::Expression; |
|
use super::shell::Shell; |
|
use std::fmt::Write; |
|
|
|
#[derive(Debug)] |
|
pub(crate) struct Call { |
|
binary: Box<&'static str>, |
|
args: Vec<&'static str>, |
|
} |
|
|
|
impl Call { |
|
pub(crate) fn new(binary: &'static str, args: Vec<&'static str>) -> Self { |
|
Self { |
|
binary: Box::from(binary), |
|
args, |
|
} |
|
} |
|
} |
|
|
|
impl<S: Shell> Expression<S> for Call { |
|
fn write_shell(&self, writer: &mut impl Write) -> std::fmt::Result { |
|
write!(writer, "{}", self.binary)?; |
|
for arg in &self.args { |
|
write!(writer, " {}", arg)?; |
|
} |
|
Ok(()) |
|
} |
|
}
|
|
|