cleanup
This commit is contained in:
parent
d3218ad907
commit
c92da26ee7
10
src/main.rs
10
src/main.rs
|
|
@ -61,7 +61,7 @@ fn main() {
|
||||||
|
|
||||||
if !fs::metadata(&data_dir).is_ok() {
|
if !fs::metadata(&data_dir).is_ok() {
|
||||||
match fs::create_dir_all(&data_dir) {
|
match fs::create_dir_all(&data_dir) {
|
||||||
Err(_e) => panic!("Could not create defult directory: {:?}", &data_dir),
|
Err(_e) => panic!("Could not create default directory: {:?}", &data_dir),
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -72,13 +72,11 @@ fn main() {
|
||||||
.map(|file| file.path());
|
.map(|file| file.path());
|
||||||
let today = Local::now().date_naive();
|
let today = Local::now().date_naive();
|
||||||
let target = today - TimeDelta::try_days(args.previous.into()).unwrap();
|
let target = today - TimeDelta::try_days(args.previous.into()).unwrap();
|
||||||
let cloesest_files = TodoFile::get_closest_files(files.collect(), target, 5);
|
let closest_files = TodoFile::get_closest_files(files.collect(), target, 5);
|
||||||
println!("{:?}", cloesest_files);
|
println!("{:?}", closest_files);
|
||||||
|
|
||||||
let latest_file = cloesest_files.first().ok_or("");
|
let latest_file = closest_files.first().ok_or("");
|
||||||
|
|
||||||
let now = Local::now();
|
|
||||||
let today = NaiveDate::from_ymd_opt(now.year(), now.month(), now.day()).unwrap();
|
|
||||||
let current_file = match latest_file {
|
let current_file = match latest_file {
|
||||||
Ok(todo_file) if todo_file.date < today => {
|
Ok(todo_file) if todo_file.date < today => {
|
||||||
let arena = Arena::new();
|
let arena = Arena::new();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue