1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-04 19:01:44 +00:00

Support for ignored-suffix CLI arguments (#1892)

This commit is contained in:
Bojan Đurđević
2021-11-19 11:05:23 -05:00
committed by GitHub
parent 59d4cfb75c
commit d6ed5e6746
10 changed files with 191 additions and 55 deletions
+6
View File
@@ -107,6 +107,12 @@ impl App {
let mut syntax_mapping = SyntaxMapping::builtin();
if let Some(values) = self.matches.values_of("ignored-suffix") {
for suffix in values {
syntax_mapping.insert_ignored_suffix(suffix);
}
}
if let Some(values) = self.matches.values_of("map-syntax") {
for from_to in values {
let parts: Vec<_> = from_to.split(':').collect();
+12
View File
@@ -509,6 +509,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.hidden_short_help(true)
.help("Show diagnostic information for bug reports.")
)
.arg(
Arg::with_name("ignored-suffix")
.number_of_values(1)
.multiple(true)
.takes_value(true)
.long("ignored-suffix")
.hidden_short_help(true)
.help(
"Ignore extension. For example:\n \
'bat --ignored-suffix \".dev\" my_file.json.dev' will use JSON syntax, and ignore '.dev'"
)
)
.help_message("Print this help message.")
.version_message("Show version information.");