#[derive(Debug, Clone, PartialEq)]
pub struct Program {
pub pipelines: Vec<Pipeline>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Pipeline {
pub commands: Vec<Command>,
pub operator: Option<Op>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum Op {
And,
Or,
Pipe,
PipeErr,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Arg {
pub name: String,
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Command {
pub raw: String,
pub name: String,
pub primary: Option<String>,
pub args: Vec<Arg>,
pub priority: Priority,
pub urgency: Urgency,
pub verbosity: i8,
pub optional: bool,
pub test_id: Option<u32>,
pub redirect: Option<Redirection>,
pub pipe: Option<Op>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum Priority {
Max,
High,
Medium,
Low,
Lowest,
}
#[derive(Debug, Clone, PartialEq)]
pub enum Urgency {
None,
Low,
Medium,
High,
}
#[derive(Debug, Clone, PartialEq)]
pub enum Redirection {
Truncate(String),
Append(String),
}
impl Command {
pub fn new(name: String, priority: Priority) -> Self {
Self {
raw: String::new(),
name,
primary: None,
args: vec![],
priority,
urgency: Urgency::None,
verbosity: 0,
optional: false,
test_id: None,
redirect: None,
pipe: None,
}
}
}