Represent commands in file uniformly
This commit is contained in:
parent
004aa87153
commit
d27812b836
3 changed files with 25 additions and 73 deletions
|
|
@ -345,38 +345,15 @@ pub struct Log {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub enum Command {
|
||||
Include(String),
|
||||
Timezone(String),
|
||||
Task(Task),
|
||||
Note(Note),
|
||||
}
|
||||
|
||||
impl Command {
|
||||
pub fn title(&self) -> &str {
|
||||
match self {
|
||||
Self::Task(task) => &task.title,
|
||||
Self::Note(note) => ¬e.title,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn desc(&self) -> &[String] {
|
||||
match self {
|
||||
Self::Task(task) => &task.desc,
|
||||
Self::Note(note) => ¬e.desc,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn statements(&self) -> &[Statement] {
|
||||
match self {
|
||||
Self::Task(task) => &task.statements,
|
||||
Self::Note(note) => ¬e.statements,
|
||||
}
|
||||
}
|
||||
Log(Log),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct File {
|
||||
pub contents: String,
|
||||
pub includes: Vec<String>,
|
||||
pub timezone: Option<String>,
|
||||
pub logs: Vec<Log>,
|
||||
pub commands: Vec<Command>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue