mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-03 11:52:26 +01:00
Support for ignored-suffix CLI arguments (#1892)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
use std::path::Path;
|
||||
|
||||
use crate::error::Result;
|
||||
use ignored_suffixes::IgnoredSuffixes;
|
||||
|
||||
use globset::{Candidate, GlobBuilder, GlobMatcher};
|
||||
|
||||
pub mod ignored_suffixes;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum MappingTarget<'a> {
|
||||
/// For mapping a path to a specific syntax.
|
||||
@@ -26,6 +29,7 @@ pub enum MappingTarget<'a> {
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct SyntaxMapping<'a> {
|
||||
mappings: Vec<(GlobMatcher, MappingTarget<'a>)>,
|
||||
pub(crate) ignored_suffixes: IgnoredSuffixes<'a>,
|
||||
}
|
||||
|
||||
impl<'a> SyntaxMapping<'a> {
|
||||
@@ -172,6 +176,10 @@ impl<'a> SyntaxMapping<'a> {
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn insert_ignored_suffix(&mut self, suffix: &'a str) {
|
||||
self.ignored_suffixes.add_suffix(suffix);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user