Files
pick/src/main.rs
2025-05-03 02:48:28 -07:00

34 lines
588 B
Rust

use walkdir::WalkDir;
pub mod manifest;
fn main() {
let file = std::fs::read_to_string("./test.toml").unwrap();
let x: manifest::Manifest = toml::from_str(&file).unwrap();
let rules = x
.rules
.iter()
.map(|rule| (rule.regex(), rule.action))
.collect::<Vec<_>>();
let walker = WalkDir::new("./target").into_iter();
for entry in walker {
let e = entry.unwrap();
let p = e.path();
let s = p.to_str().unwrap();
if !p.is_file() {
continue;
}
let m = rules
.iter()
.find(|(r, _)| r.is_match(s))
.map(|x| x.1.clone());
println!(" {m:?} {s}")
}
}