fix: 调整命令行参数解析

This commit is contained in:
jackfiled 2024-01-25 10:36:29 +08:00
parent ab32ca97e6
commit a338ee6b2f

View File

@ -11,11 +11,7 @@ async fn main() {
let fetcher = Fetcher::new();
let args: Vec<String> = std::env::args().collect();
let operation = &args[1].as_str();
match operation {
&"get" => {
let id = args[2].parse::<u32>();
let id = args[1].parse::<u32>();
match id {
Ok(id) => {
@ -39,9 +35,6 @@ async fn main() {
eprintln!("Get operation needs a usize param.")
}
}
}
_ => {}
}
}
fn write_file(file_name: &String, file_content: &String) -> std::io::Result<()> {