Make info fail if you pass empty arguments
This commit is contained in:
parent
9e43a5818d
commit
0d84c57106
|
@ -421,7 +421,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nhentairs"
|
name = "nhentairs"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "nhentairs"
|
name = "nhentairs"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
authors = ["blank X <theblankx@protonmail.com>"]
|
authors = ["blank X <theblankx@protonmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,12 @@ pub async fn run(args: env::Args) {
|
||||||
for arg in args {
|
for arg in args {
|
||||||
query.push_str(&format!(" {}", arg));
|
query.push_str(&format!(" {}", arg));
|
||||||
}
|
}
|
||||||
if query.len() < 1 {
|
let query = query.trim();
|
||||||
|
if query.is_empty() {
|
||||||
eprintln!("Missing search query");
|
eprintln!("Missing search query");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
let client = reqwest::Client::new();
|
let search_info = utils::get_search_info(reqwest::Client::new(), &query).await.unwrap();
|
||||||
let search_info = utils::get_search_info(client.clone(), &query[1..]).await.unwrap();
|
|
||||||
if search_info.num_pages < 1 {
|
if search_info.num_pages < 1 {
|
||||||
eprintln!("No results found");
|
eprintln!("No results found");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in New Issue