diff --git a/Cargo.lock b/Cargo.lock index 56dcfca..f33cbde 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -421,7 +421,7 @@ dependencies = [ [[package]] name = "nhentairs" -version = "0.5.1" +version = "0.5.2" dependencies = [ "reqwest", "serde", diff --git a/Cargo.toml b/Cargo.toml index 38d16bc..71dc12e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nhentairs" -version = "0.5.1" +version = "0.5.2" authors = ["blank X "] edition = "2018" diff --git a/src/commands/search.rs b/src/commands/search.rs index c9d36d0..42ec25c 100644 --- a/src/commands/search.rs +++ b/src/commands/search.rs @@ -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);