Restructure commands a bit

This commit is contained in:
Joscha 2021-11-06 18:51:54 +01:00
parent a8ddaefa78
commit dea704065c

View file

@ -25,34 +25,32 @@ struct TimeDelta {
} }
#[derive(Debug)] #[derive(Debug)]
enum EndDate { struct EndDateSpec {
Fixed(NaiveDate), end: Option<NaiveDate>,
Delta(DateDelta), delta: Option<Delta>,
}
#[derive(Debug)]
enum EndTime {
Fixed(NaiveTime),
Delta(TimeDelta),
} }
#[derive(Debug)] #[derive(Debug)]
struct DateSpec { struct DateSpec {
start: NaiveDate, start: NaiveDate,
end: Option<EndDate>, start_time: Option<NaiveTime>,
repeat: Option<DateDelta>, offset: Option<Delta>,
end: Option<EndDateSpec>,
repeat: Option<Delta>,
} }
#[derive(Debug)] // #[derive(Debug)]
struct TimeSpec { // struct FormulaSpec {
start: NaiveTime, // start: (), // TODO Formula
end: Option<EndTime>, // start_time: Option<NaiveTime>,
} // offset: Option<Delta>,
// end: Option<Delta>,
// }
#[derive(Debug)] #[derive(Debug)]
struct WhenSpec { enum Spec {
date: DateSpec, Date(DateSpec),
time: Option<TimeSpec>, // Formula(FormulaSpec),
} }
#[derive(Debug)] #[derive(Debug)]
@ -64,7 +62,7 @@ struct Done {
#[derive(Debug)] #[derive(Debug)]
struct Task { struct Task {
title: String, title: String,
when: Option<WhenSpec>, when: Option<Spec>,
desc: Option<String>, desc: Option<String>,
dones: Vec<Done>, dones: Vec<Done>,
} }
@ -72,14 +70,14 @@ struct Task {
#[derive(Debug)] #[derive(Debug)]
struct Note { struct Note {
title: String, title: String,
when: WhenSpec, when: Spec,
desc: Option<String>, desc: Option<String>,
} }
#[derive(Debug)] #[derive(Debug)]
enum BirthdaySpec { struct BirthdaySpec {
Date(NaiveDate), date: NaiveDate,
DateWithoutYear { month: u8, day: u8 }, year_known: bool, // If year is unknown, use NaiveDate of year 0
} }
#[derive(Debug)] #[derive(Debug)]