Exit with 1 if there's at least one fail on info
This commit is contained in:
parent
cea920a080
commit
045bb9d6ca
|
@ -421,7 +421,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nhentairs"
|
||||
version = "0.2.2"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"reqwest",
|
||||
"serde",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "nhentairs"
|
||||
version = "0.2.2"
|
||||
version = "0.3.0"
|
||||
authors = ["blank X <theblankx@protonmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ use crate::structs;
|
|||
use std::env;
|
||||
use std::process::exit;
|
||||
use tokio::task::JoinHandle;
|
||||
//use std::collections::BTreeMap;
|
||||
extern crate tokio;
|
||||
extern crate reqwest;
|
||||
|
||||
|
@ -23,15 +22,22 @@ pub async fn run(args: env::Args) {
|
|||
(utils::get_sauce_info(cloned_client, sauce).await.unwrap(), sauce)
|
||||
}));
|
||||
}
|
||||
let mut fail = false;
|
||||
for handle in handles {
|
||||
let (sauce_info, sauce) = handle.await.unwrap();
|
||||
match sauce_info {
|
||||
structs::GalleryInfo::Info(sauce_info) => println!("{}", utils::human_sauce_info(&sauce_info)),
|
||||
structs::GalleryInfo::Error(sauce_error) => eprintln!("Sauce: {}\nError: {}", sauce, sauce_error.error)
|
||||
structs::GalleryInfo::Error(sauce_error) => {
|
||||
eprintln!("Sauce: {}\nError: {}", sauce, sauce_error.error);
|
||||
fail = true;
|
||||
}
|
||||
};
|
||||
if remaining_to_show > 1 {
|
||||
println!("");
|
||||
remaining_to_show -= 1;
|
||||
}
|
||||
}
|
||||
if fail {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue