Fixed not checking correctly for empty strings.
This commit is contained in:
parent
19929580da
commit
eafa2550bb
1 changed files with 4 additions and 3 deletions
|
@ -41,9 +41,8 @@ fn main() -> Result<(), ureq::Error> {
|
||||||
|
|
||||||
let options = parse_args();
|
let options = parse_args();
|
||||||
|
|
||||||
let mut query = String::new();
|
|
||||||
let mut output = String::with_capacity(51200); /* Give output 50KiB of buffer; Should be enough to avoid reallocs*/
|
let mut output = String::with_capacity(51200); /* Give output 50KiB of buffer; Should be enough to avoid reallocs*/
|
||||||
query = options.query.trim().to_string().clone();
|
let mut query = options.query.trim().to_string().clone();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if options.interactive || options.query.trim().is_empty() {
|
if options.interactive || options.query.trim().is_empty() {
|
||||||
|
@ -55,6 +54,7 @@ fn main() -> Result<(), ureq::Error> {
|
||||||
/* Exit on EOF */
|
/* Exit on EOF */
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
query = query.trim().to_string();
|
||||||
}
|
}
|
||||||
} else if query == ":" || query == ":" || query == "_" || query == "_" {
|
} else if query == ":" || query == ":" || query == "_" || query == "_" {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -89,7 +89,8 @@ fn main() -> Result<(), ureq::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { /* Word search */
|
} else { /* Word search */
|
||||||
// Do API request
|
|
||||||
|
/* Do API request */
|
||||||
let body: Value = ureq::get(&format!(JISHO_URL!(), query))
|
let body: Value = ureq::get(&format!(JISHO_URL!(), query))
|
||||||
.call()?
|
.call()?
|
||||||
.into_json()?;
|
.into_json()?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue