Can specify language name with -l in any case

This commit is contained in:
greg 2017-12-09 18:19:07 -08:00
parent fe0e58efe7
commit 4d89dcc85e

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();