1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-26 17:31:42 +00:00

Initial implementation of glob-based syntax mapping

This commit is contained in:
sharkdp
2020-03-22 09:55:13 +01:00
committed by David Peter
parent ba29e07636
commit bd8a13dbc9
7 changed files with 137 additions and 42 deletions
+4 -4
View File
@@ -18,8 +18,8 @@ use ansi_term;
use bat::{
config::{
Config, HighlightedLineRanges, InputFile, LineRange, LineRanges, OutputWrap, PagingMode,
StyleComponent, StyleComponents, SyntaxMapping,
Config, HighlightedLineRanges, InputFile, LineRange, LineRanges, MappingTarget, OutputWrap,
PagingMode, StyleComponent, StyleComponents, SyntaxMapping,
},
errors::*,
HighlightingAssets,
@@ -104,7 +104,7 @@ impl App {
}
};
let mut syntax_mapping = SyntaxMapping::new();
let mut syntax_mapping = SyntaxMapping::builtin();
if let Some(values) = self.matches.values_of("map-syntax") {
for from_to in values {
@@ -114,7 +114,7 @@ impl App {
return Err("Invalid syntax mapping. The format of the -m/--map-syntax option is 'from:to'.".into());
}
syntax_mapping.insert(parts[0], parts[1]);
syntax_mapping.insert(parts[0], MappingTarget::MapTo(parts[1]))?;
}
}