pub_just/
interpreter.rs

1use super::*;
2
3#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize)]
4pub struct Interpreter<'src> {
5  pub arguments: Vec<StringLiteral<'src>>,
6  pub command: StringLiteral<'src>,
7}
8
9impl<'src> Interpreter<'src> {
10  pub fn default_script_interpreter() -> &'static Interpreter<'static> {
11    static INSTANCE: Lazy<Interpreter<'static>> = Lazy::new(|| Interpreter {
12      arguments: vec![StringLiteral::from_raw("-eu")],
13      command: StringLiteral::from_raw("sh"),
14    });
15    &INSTANCE
16  }
17}
18
19impl<'src> Display for Interpreter<'src> {
20  fn fmt(&self, f: &mut Formatter) -> fmt::Result {
21    write!(f, "{}", self.command)?;
22
23    for argument in &self.arguments {
24      write!(f, ", {argument}")?;
25    }
26
27    Ok(())
28  }
29}