#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Operator {
And,
Or,
Semi,
Pipe,
PipeErr,
}
impl Operator {
pub fn as_str(&self) -> &'static str {
match self {
Operator::And => "&&",
Operator::Or => "||",
Operator::Semi => ";",
Operator::Pipe => "|",
Operator::PipeErr => "|&",
}
}
}
#[derive(Debug, Clone)]
pub struct ShellSegment {
pub command: String,
pub redirection: Option<Redirection>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Redirection {
pub description: String,
}
#[derive(Debug, Clone)]
pub struct ParsedPipeline {
pub segments: Vec<ShellSegment>,
pub operators: Vec<Operator>,
}