#[derive(Debug, Clone)]
pub struct Redirect {
pub n: Option<usize>,
pub file: String,
pub mode: RedirectMode,
}
#[derive(Debug, Clone)]
pub enum RedirectMode {
Read,
Write,
ReadAppend,
WriteAppend,
ReadDup,
WriteDup,
ReadWrite,
}
#[derive(Debug, Clone)]
pub struct Assign {
pub var: String,
pub val: String,
}
#[derive(Debug, Clone)]
pub enum SeparatorOp {
Amp,
Semi,
}
#[derive(Debug, Clone)]
pub enum Command {
Simple {
assigns: Vec<Assign>,
redirects: Vec<Redirect>,
args: Vec<String>,
},
Pipeline(Box<Command>, Box<Command>),
And(Box<Command>, Box<Command>),
Or(Box<Command>, Box<Command>),
Not(Box<Command>),
AsyncList(Box<Command>, Option<Box<Command>>),
SeqList(Box<Command>, Option<Box<Command>>),
Subshell(Box<Command>),
If {
conds: Vec<Condition>,
else_part: Option<Box<Command>>,
},
While {
cond: Box<Command>,
body: Box<Command>,
},
Until {
cond: Box<Command>,
body: Box<Command>,
},
For {
name: String,
wordlist: Vec<String>,
body: Box<Command>,
},
Case { word: String, arms: Vec<CaseArm> },
Fn { fname: String, body: Box<Command> },
None,
}
#[derive(Debug, Clone)]
pub struct CaseArm {
pub pattern: Vec<String>,
pub body: Box<Command>,
}
#[derive(Debug, Clone)]
pub struct Condition {
pub cond: Box<Command>,
pub body: Box<Command>,
}