eval 加点功能

This commit is contained in:
shenjack 2024-06-25 21:59:38 +08:00
parent ca3e091826
commit c0e36c584a
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -12,6 +12,23 @@ use evaluate::NamerEvaluater;
fn main() {
// 获取 cli 参数
let arg = env::args().nth(1).expect("need a name to evaluate");
if arg == "-f" {
let arg = env::args().nth(2).expect("need a file to evaluate");
let file = std::fs::read_to_string(arg).expect("file not found");
let names = file.lines().collect::<Vec<_>>();
for name in names {
let mut name = name::Namer::new(&name.to_string()).expect("your name have some thing wrong");
name.update_skill();
let xu = evaluate::xuping::XuPing2_0_1015::evaluate(&name);
let xd = evaluate::xuping::XuPing2_0_1015_QD::evaluate(&name);
println!("{xu}|{xd}")
}
return;
} else if arg == "-h" {
println!("Usage: xp_eval [name]");
println!(" xp_eval -f [file]");
return;
}
let mut name = name::Namer::new(&arg).expect("your name have some thing wrong");
name.update_skill();