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