From c0e36c584a6736f65d97055d81ddc827e40cd01d Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 25 Jun 2024 21:59:38 +0800 Subject: [PATCH] =?UTF-8?q?eval=20=E5=8A=A0=E7=82=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miner/src/xp_eval.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/miner/src/xp_eval.rs b/miner/src/xp_eval.rs index 1038437..a4bd9fc 100644 --- a/miner/src/xp_eval.rs +++ b/miner/src/xp_eval.rs @@ -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::>(); + 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();