Final final changes before release.

This commit is contained in:
Hiers 2024-01-28 09:41:27 +00:00
parent 5f329ccab4
commit 19929580da
6 changed files with 88 additions and 113 deletions

View file

@ -55,8 +55,8 @@ pub fn search_by_radical(query: &mut String) -> Option<()> {
}
println!();
}
Err(_e) => eprintln!("Error while reading radkfile\nIf you don't have the radkfile, download it from \
https://www.edrdg.org/krad/kradinf.html and place it in \"~/.local/share/\" on Linux or \"~\\AppData\\Local\\\" on Windows. \
Err(_e) => eprintln!("Error while reading radkfile\nIf you don't have the radkfile, download it from\n\
https://www.edrdg.org/krad/kradinf.html and place it in \"~/.local/share/\" on Linux or \"~\\AppData\\Local\\\" on Windows.\n\
This file is needed to search radicals by strokes."),
}
Some(())

View file

@ -43,10 +43,9 @@ fn main() -> Result<(), ureq::Error> {
let mut query = String::new();
let mut output = String::with_capacity(51200); /* Give output 50KiB of buffer; Should be enough to avoid reallocs*/
loop {
query = options.query.trim().to_string().clone();
query.clear();
query = options.query.trim().to_string().clone();
loop {
if options.interactive || options.query.trim().is_empty() {
while query.is_empty() || query == ":" || query == "" || query == "_" || query == "_" {
query.clear();
@ -113,6 +112,8 @@ fn main() -> Result<(), ureq::Error> {
if !options.interactive && !options.query.trim().is_empty() {
break;
}
query.clear();
}
Ok(())
}
@ -123,8 +124,8 @@ fn parse_args() -> util::Options {
{
let mut ap = ArgumentParser::new();
ap.set_description("Use jisho.org from the cli. \
Searching for kanji by radicals is also available if the radkfile file is installed in \"~/.local/share\" \
(linux) or \"~\\AppData\\Local\\\" (windows). \
Searching for kanji by radicals is also available if the radkfile file is \
installed in \"~/.local/share\" (linux) or \"~\\AppData\\Local\\\" (windows). \
Additionally, searching for sentences in tatoeba is also possible.");
ap.add_option(
&["-V", "--version"],

View file

@ -15,8 +15,8 @@ pub fn sentence_search(options: &Options, body: Value, output: &mut String) -> O
let mut i = 1;
/*
* Each entry is an english or japanese sentence and we're pairing it up with the equivalents in
* the translations array
* Each entry is an english or japanese sentence and we're pairing it up
* with the equivalent sentences in the translations array
*/
for entry in body.iter() {
if i >= options.limit && options.limit != 0 {