Start reorganizing code by creating files module

This commit is contained in:
Joscha 2021-11-21 22:48:41 +01:00
parent f1ff3f7aaa
commit 5674bcdc00
5 changed files with 232 additions and 16 deletions

View file

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