quote in name handling somewhat

This commit is contained in:
Robin Appelman 2023-03-16 20:45:07 +01:00
commit de2e940974
5 changed files with 81 additions and 9 deletions

28
examples/dir.rs Normal file
View file

@ -0,0 +1,28 @@
use main_error::MainError;
use std::env::args;
use std::ffi::OsStr;
use std::fs;
use tf_log_parser::parse;
use walkdir::WalkDir;
fn main() -> Result<(), MainError> {
let path = args().nth(1).expect("No path provided");
for entry in WalkDir::new(path) {
let entry = entry?;
let path = entry.path();
if path.extension() == Some(OsStr::new("log")) {
print!("{} - ", path.display());
let input = match fs::read_to_string(path) {
Ok(input) => input,
Err(e) => {
println!("failed to read file: {}", e);
continue;
}
};
let (output, _) = parse(&input)?;
println!("{} messages", output.chat.len());
}
}
Ok(())
}