Start reorganizing code by creating files module
This commit is contained in:
parent
f1ff3f7aaa
commit
5674bcdc00
5 changed files with 232 additions and 16 deletions
17
src/main.rs
17
src/main.rs
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue