mirror of
https://github.com/sharkdp/bat.git
synced 2025-03-14 06:38:24 +00:00
Filter out languages without extensions
This commit is contained in:
parent
fd68af8031
commit
f7af537018
@ -571,14 +571,14 @@ fn run() -> Result<()> {
|
|||||||
|
|
||||||
let longest = languages
|
let longest = languages
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|s| !s.hidden)
|
.filter(|s| !s.hidden && s.file_extensions.len() > 0)
|
||||||
.map(|s| s.name.len())
|
.map(|s| s.name.len())
|
||||||
.max()
|
.max()
|
||||||
.unwrap_or(32); // Fallback width if they have no language definitions.
|
.unwrap_or(32); // Fallback width if they have no language definitions.
|
||||||
|
|
||||||
let separator = " ";
|
let separator = " ";
|
||||||
for lang in languages {
|
for lang in languages {
|
||||||
if lang.hidden {
|
if lang.hidden || lang.file_extensions.len() == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
print!("{:width$}{}", lang.name, separator, width = longest);
|
print!("{:width$}{}", lang.name, separator, width = longest);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user