diff --git a/Cargo.lock b/Cargo.lock index cf8a68c..59da77e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,92 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "time", + "winapi", +] + +[[package]] +name = "libc" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673" + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi", + "winapi", +] + [[package]] name = "today" version = "0.1.0" +dependencies = [ + "chrono", +] + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 69a316f..14aa956 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,4 @@ version = "0.1.0" edition = "2018" [dependencies] +chrono = "0.4.19" diff --git a/README.md b/README.md index 55be093..89680a9 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ DATE 2021-12-07 16:00 Including empty lines (not even whitespace) in-between As long as the text stays indented, it's still part of it -BIRTHDAY John Doe () +BIRTHDAY John Doe DATE 1987-05-12 BIRTHDAY Jane Doe diff --git a/src/commands.rs b/src/commands.rs new file mode 100644 index 0000000..e523e66 --- /dev/null +++ b/src/commands.rs @@ -0,0 +1,87 @@ +use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; + +#[derive(Debug)] +struct DateDelta { + years: i32, + months: i32, + weeks: i32, + days: i32, +} + +#[derive(Debug)] +struct TimeDelta { + hours: i32, + minutes: i32, +} + +#[derive(Debug)] +enum EndDate { + Fixed(NaiveDate), + Delta(DateDelta), +} + +#[derive(Debug)] +enum EndTime { + Fixed(NaiveTime), + Delta(TimeDelta), +} + +#[derive(Debug)] +struct DateSpec { + start: NaiveDate, + end: Option, + repeat: Option, +} + +#[derive(Debug)] +struct TimeSpec { + start: NaiveTime, + end: Option, +} + +#[derive(Debug)] +struct WhenSpec { + date: DateSpec, + time: Option, +} + +#[derive(Debug)] +struct Done { + refering_to: Option, + created_at: Option, +} + +#[derive(Debug)] +struct Task { + title: String, + when: Option, + desc: Option, + dones: Vec, +} + +#[derive(Debug)] +struct Note { + title: String, + when: WhenSpec, + desc: Option, +} + +#[derive(Debug)] +enum BirthdaySpec { + Date(NaiveDate), + DateWithoutYear { month: u8, day: u8 }, +} + +#[derive(Debug)] +struct Birthday { + title: String, + when: BirthdaySpec, + desc: Option, +} + +#[derive(Debug)] +enum Command { + Task(Task), + Note(Note), + Birthday(Birthday), +} diff --git a/src/main.rs b/src/main.rs index e7a11a9..b97e52d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +mod commands; + fn main() { println!("Hello, world!"); }