mirror of
https://github.com/mrfluffy-dev/kami.git
synced 2026-01-17 12:50:32 +00:00
reworked the light novel menue to make it more cohesive as well as did error handeling in ln/search.rs
This commit is contained in:
@@ -29,13 +29,9 @@ pub fn search_ln() -> String {
|
||||
}
|
||||
count += 1;
|
||||
});
|
||||
println!("(n)\t{}", "Search another title".red());
|
||||
let mut ln_number = String::new();
|
||||
std::io::stdin()
|
||||
.read_line(&mut ln_number)
|
||||
.expect("Failed to read line");
|
||||
ln_number = ln_number.trim().to_string();
|
||||
if ln_number != "n" {
|
||||
println!("(s)\t{}", "Search another title".green());
|
||||
let ln_number = string_input("Enter an option: ");
|
||||
if ln_number != "s" && ln_number.parse::<usize>().is_ok() {
|
||||
let ln_number = ln_number.trim().to_string();
|
||||
let ln_number = ln_number.parse::<usize>().unwrap();
|
||||
let ln_url = &ln_urls[ln_number];
|
||||
@@ -43,6 +39,8 @@ pub fn search_ln() -> String {
|
||||
_is_n = true;
|
||||
print!("\x1B[2J\x1B[1;1H");
|
||||
return ln_url;
|
||||
} else {
|
||||
print!("invalid input");
|
||||
}
|
||||
print!("\x1B[2J\x1B[1;1H");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user