mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-11-30 04:40:47 +01:00
20 lines
572 B
Rust
20 lines
572 B
Rust
use main_error::MainError;
|
|
use std::env::args;
|
|
use std::fs;
|
|
use tf_log_parser::module::Kills;
|
|
use tf_log_parser::{parse_with_handler, Class};
|
|
|
|
fn main() -> Result<(), MainError> {
|
|
let path = args().nth(1).expect("No path provided");
|
|
let content = fs::read_to_string(path)?;
|
|
|
|
let kills = parse_with_handler::<Kills>(&content)?.0;
|
|
|
|
for kill in kills {
|
|
if kill.victim.class == Class::Medic && kill.charge.is_none() {
|
|
panic!("medic death without charge");
|
|
}
|
|
println!("{}", serde_json::to_string(&kill)?);
|
|
}
|
|
Ok(())
|
|
}
|