Tshepang Mbambo 2022-08-19 07:19:14 +02:00 committed by Noah Lev
parent 23ae7bb49f
commit dc6fcaeae8
1 changed files with 7 additions and 1 deletions

View File

@ -3,6 +3,7 @@ use std::{
convert::TryInto as _, convert::TryInto as _,
env, fmt, fs, env, fmt, fs,
path::{Path, PathBuf}, path::{Path, PathBuf},
process,
str::FromStr, str::FromStr,
}; };
@ -124,7 +125,12 @@ fn filter_dates(
} }
fn main() { fn main() {
let root_dir = env::args().nth(1).unwrap_or(".".into()); let mut args = env::args();
if args.len() == 1 {
eprintln!("error: expected root Markdown directory as CLI argument");
process::exit(1);
}
let root_dir = args.nth(1).unwrap();
let root_dir_path = Path::new(&root_dir); let root_dir_path = Path::new(&root_dir);
let glob_pat = format!("{}/**/*.md", root_dir); let glob_pat = format!("{}/**/*.md", root_dir);
let today_chrono = Utc::today(); let today_chrono = Utc::today();