Skip to content

Commit 36b2bcf

Browse files
committed
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 .
1 parent d3daa1f commit 36b2bcf

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Diff for: ci/date-check/src/main.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
use std::{
2-
collections::BTreeMap,
3-
convert::TryInto as _,
4-
env, fmt, fs,
5-
path::{Path, PathBuf},
6-
str::FromStr,
2+
collections::BTreeMap, convert::TryInto as _, env, fmt, fs, path::PathBuf, str::FromStr,
73
};
84

95
use chrono::{Datelike as _, Month, TimeZone as _, Utc};
@@ -127,7 +123,6 @@ fn main() {
127123
let root_dir = env::args()
128124
.nth(1)
129125
.expect("expect root Markdown directory as CLI argument");
130-
let root_dir_path = Path::new(&root_dir);
131126
let glob_pat = format!("{}/**/*.md", root_dir);
132127
let today_chrono = Utc::today();
133128
let current_month = Date {
@@ -165,10 +160,7 @@ fn main() {
165160
println!();
166161

167162
for (path, dates) in dates_by_file {
168-
println!(
169-
"- [ ] {}",
170-
path.strip_prefix(&root_dir_path).unwrap().display()
171-
);
163+
println!("- [ ] {}", path.display());
172164
for (line, date) in dates {
173165
println!(" - [ ] line {}: {}", line, date);
174166
}

0 commit comments

Comments
 (0)