fix: 调整命令行参数解析
This commit is contained in:
parent
ab32ca97e6
commit
a338ee6b2f
|
@ -11,11 +11,7 @@ async fn main() {
|
||||||
let fetcher = Fetcher::new();
|
let fetcher = Fetcher::new();
|
||||||
|
|
||||||
let args: Vec<String> = std::env::args().collect();
|
let args: Vec<String> = std::env::args().collect();
|
||||||
let operation = &args[1].as_str();
|
let id = args[1].parse::<u32>();
|
||||||
|
|
||||||
match operation {
|
|
||||||
&"get" => {
|
|
||||||
let id = args[2].parse::<u32>();
|
|
||||||
|
|
||||||
match id {
|
match id {
|
||||||
Ok(id) => {
|
Ok(id) => {
|
||||||
|
@ -40,9 +36,6 @@ async fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn write_file(file_name: &String, file_content: &String) -> std::io::Result<()> {
|
fn write_file(file_name: &String, file_content: &String) -> std::io::Result<()> {
|
||||||
let file_path = Path::new("./src/problem").join(format!("{}.rs", file_name));
|
let file_path = Path::new("./src/problem").join(format!("{}.rs", file_name));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user