2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-15 00:12:57 +00:00

Display language and extensions from loaded assets.

This commit is contained in:
Connor Kuehl 2018-05-07 09:25:47 -07:00 committed by David Peter
parent 67bed73e15
commit 9b0877102c

View File

@ -565,6 +565,26 @@ fn run() -> Result<()> {
)
})?;
if let Some(_) = app_matches.values_of("list languages") {
let languages = assets.syntax_set.syntaxes();
for lang in languages {
print!("{}\t", lang.name);
for i in 0..lang.file_extensions.len() {
print!("{}", lang.file_extensions[i]);
if i < lang.file_extensions.len() - 1 {
print!(", ");
} else {
println!();
}
}
}
return Ok(());
}
let mut output_type = get_output_type(options.paging);
let handle = output_type.handle()?;
let mut printer = Printer::new(handle, &options);