Evaluate birthdays

This commit is contained in:
Joscha 2021-11-20 16:08:13 +01:00
parent 48faf910fd
commit f1ff3f7aaa
3 changed files with 242 additions and 1 deletions

View file

@ -1,9 +1,13 @@
use std::fs;
use std::path::PathBuf;
use chrono::NaiveDate;
use structopt::StructOpt;
use crate::eval::entries::DateRange;
mod commands;
mod eval;
mod format;
mod parse;
@ -17,6 +21,13 @@ fn main() -> anyhow::Result<()> {
let opt = Opt::from_args();
let content = fs::read_to_string(&opt.file)?;
let file = parse::parse(&opt.file, &content)?;
print!("{}", file);
let entries = eval::eval(
&file,
DateRange::new(
NaiveDate::from_ymd(2021, 1, 1),
NaiveDate::from_ymd(2021, 12, 31),
),
)?;
println!("{:#?}", entries);
Ok(())
}