Can specify language name with -l in any case

This commit is contained in:
greg 2017-12-09 18:19:07 -08:00
parent 7e7aa55d6e
commit 0e7b6f25b3

View File

@ -60,7 +60,7 @@ pub fn schala_main(generators: Vec<PLIGenerator>) {
let language_names: Vec<String> = languages.iter().map(|lang| {lang.get_language_name()}).collect(); let language_names: Vec<String> = languages.iter().map(|lang| {lang.get_language_name()}).collect();
let initial_index: usize = let initial_index: usize =
option_matches.opt_str("lang") option_matches.opt_str("lang")
.and_then(|lang| { language_names.iter().position(|x| { *x == lang }) }) .and_then(|lang| { language_names.iter().position(|x| { x.to_lowercase() == lang.to_lowercase() }) })
.unwrap_or(0); .unwrap_or(0);
let mut options = EvalOptions::default(); let mut options = EvalOptions::default();