From dea704065cd9b8987d8f78f987f201f32aed723e Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 6 Nov 2021 18:51:54 +0100 Subject: [PATCH] Restructure commands a bit --- src/commands.rs | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 5dc439b..bdf0398 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -25,34 +25,32 @@ struct TimeDelta { } #[derive(Debug)] -enum EndDate { - Fixed(NaiveDate), - Delta(DateDelta), -} - -#[derive(Debug)] -enum EndTime { - Fixed(NaiveTime), - Delta(TimeDelta), +struct EndDateSpec { + end: Option, + delta: Option, } #[derive(Debug)] struct DateSpec { start: NaiveDate, - end: Option, - repeat: Option, + start_time: Option, + offset: Option, + end: Option, + repeat: Option, } -#[derive(Debug)] -struct TimeSpec { - start: NaiveTime, - end: Option, -} +// #[derive(Debug)] +// struct FormulaSpec { +// start: (), // TODO Formula +// start_time: Option, +// offset: Option, +// end: Option, +// } #[derive(Debug)] -struct WhenSpec { - date: DateSpec, - time: Option, +enum Spec { + Date(DateSpec), + // Formula(FormulaSpec), } #[derive(Debug)] @@ -64,7 +62,7 @@ struct Done { #[derive(Debug)] struct Task { title: String, - when: Option, + when: Option, desc: Option, dones: Vec, } @@ -72,14 +70,14 @@ struct Task { #[derive(Debug)] struct Note { title: String, - when: WhenSpec, + when: Spec, desc: Option, } #[derive(Debug)] -enum BirthdaySpec { - Date(NaiveDate), - DateWithoutYear { month: u8, day: u8 }, +struct BirthdaySpec { + date: NaiveDate, + year_known: bool, // If year is unknown, use NaiveDate of year 0 } #[derive(Debug)]