Evaluate some simple statements

This commit is contained in:
Joscha 2021-12-04 22:37:01 +01:00
parent 778576a63c
commit 3a219ecac2
6 changed files with 184 additions and 12 deletions

View file

@ -355,7 +355,11 @@ pub enum Statement {
From(Option<NaiveDate>),
Until(Option<NaiveDate>),
Except(NaiveDate), // TODO Allow excluding ranges
Move(NaiveDate, NaiveDate),
Move {
span: Span,
from: NaiveDate,
to: NaiveDate,
},
}
#[derive(Debug, Clone, Copy)]
@ -440,6 +444,22 @@ pub enum Command {
Note(Note),
}
impl Command {
pub fn title(&self) -> &str {
match self {
Command::Task(task) => &task.title,
Command::Note(note) => &note.title,
}
}
pub fn desc(&self) -> &[String] {
match self {
Command::Task(task) => &task.desc,
Command::Note(note) => &note.desc,
}
}
}
#[derive(Debug)]
pub struct File {
pub contents: String,