make date-check more easy to use
One could not run it like the following, for the would be a panic:
cargo run --manifest-path ci/date-check/Cargo.toml .
Also, remove the need to specify argument, in which case, current_dir
is assumed.
This commit is contained in:
parent
c9a2c851c9
commit
23ae7bb49f
|
|
@ -124,9 +124,7 @@ fn filter_dates(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let root_dir = env::args()
|
let root_dir = env::args().nth(1).unwrap_or(".".into());
|
||||||
.nth(1)
|
|
||||||
.expect("expect root Markdown directory as CLI argument");
|
|
||||||
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();
|
||||||
|
|
@ -167,7 +165,7 @@ fn main() {
|
||||||
for (path, dates) in dates_by_file {
|
for (path, dates) in dates_by_file {
|
||||||
println!(
|
println!(
|
||||||
"- [ ] {}",
|
"- [ ] {}",
|
||||||
path.strip_prefix(&root_dir_path).unwrap().display()
|
path.strip_prefix(&root_dir_path).unwrap_or(&path).display(),
|
||||||
);
|
);
|
||||||
for (line, date) in dates {
|
for (line, date) in dates {
|
||||||
println!(" - [ ] line {}: {}", line, date);
|
println!(" - [ ] line {}: {}", line, date);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue