fixed argument bug

This commit is contained in:
Zastian Pretorius
2022-07-18 15:49:26 +01:00
parent 533cb1732a
commit 8d31ef456e

View File

@@ -31,15 +31,21 @@ fn main() {
anime = true; anime = true;
//look at the next argument and see if it is a search term //look at the next argument and see if it is a search term
if let Some(arg) = std::env::args().nth(count + 1) { if let Some(arg) = std::env::args().nth(count + 1) {
if !arg.starts_with("-") {
search = arg; search = arg;
} }
} }
}
if arg == "--ln" || arg == "-l" { if arg == "--ln" || arg == "-l" {
ln = true; ln = true;
//if let Some(arg) = std::env::args().nth(count + 1) and that arg does not start with a '-' set search to that arg
if let Some(arg) = std::env::args().nth(count + 1) { if let Some(arg) = std::env::args().nth(count + 1) {
if !arg.starts_with("-") {
search = arg; search = arg;
} }
} }
}
if arg == "--chapter" || arg == "-c" { if arg == "--chapter" || arg == "-c" {
if let Some(arg) = std::env::args().nth(count + 1) { if let Some(arg) = std::env::args().nth(count + 1) {
chapter = arg.parse::<u32>().unwrap(); chapter = arg.parse::<u32>().unwrap();