diff --git a/CHANGELOG.md b/CHANGELOG.md index c0b9fae..d12e3d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - `REMIND` statement +- `MOVE` entries to a different time ## 0.1.0 - 2021-12-20 diff --git a/src/eval/command.rs b/src/eval/command.rs index 8bdac96..b277a7d 100644 --- a/src/eval/command.rs +++ b/src/eval/command.rs @@ -1,11 +1,11 @@ use std::collections::HashMap; -use chrono::NaiveDate; +use chrono::{Duration, NaiveDate}; use crate::files::commands::{ self, BirthdaySpec, Command, Done, DoneDate, Note, Spec, Statement, Task, }; -use crate::files::primitives::{Span, Spanned}; +use crate::files::primitives::{Span, Spanned, Time}; use crate::files::SourcedCommand; use super::date::Dates; @@ -220,7 +220,12 @@ impl<'a> CommandState<'a> { Statement::From(date) => self.from = *date, Statement::Until(date) => self.until = *date, Statement::Except(date) => self.eval_except(*date), - Statement::Move { span, from, to } => self.eval_move(*span, *from, *to)?, + Statement::Move { + span, + from, + to, + to_time, + } => self.eval_move(*span, *from, *to, *to_time)?, Statement::Remind(delta) => self.eval_remind(delta), } Ok(()) @@ -242,13 +247,31 @@ impl<'a> CommandState<'a> { self.dated.remove(&date); } - fn eval_move(&mut self, span: Span, from: NaiveDate, to: NaiveDate) -> Result<()> { + fn eval_move( + &mut self, + span: Span, + from: NaiveDate, + to: Option, + to_time: Option