Try to load language for --do-you-understand

This commit is contained in:
xenia 2023-11-12 11:42:22 +01:00
parent 169380d8bc
commit d62b1657c3

View File

@ -37,7 +37,16 @@ fn main() {
if let Some(filetype) = matches.value_of("do-you-understand") { if let Some(filetype) = matches.value_of("do-you-understand") {
let language = ffi::filetype_to_language(filetype); let language = ffi::filetype_to_language(filetype);
std::process::exit(if language.is_some() { 0 } else { 1 }); if let Some(language) = language {
eprintln!("Known language. Trying to load");
let mut parser = Parser::new();
parser.set_language(language).unwrap();
eprintln!("Loaded successfully");
std::process::exit(0);
} else {
eprintln!("Unknown language");
std::process::exit(1);
}
} }
let config = if let Some(config_path) = matches.value_of("config") { let config = if let Some(config_path) = matches.value_of("config") {