1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-16 18:22:28 +01:00

style: add component 'rule' for horizontal file delimiter

This commit is contained in:
Tom Milligan
2020-10-06 16:57:47 +01:00
parent 33128d75f2
commit aa4000cb0d
23 changed files with 441 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ struct ActiveStyleComponents {
header: bool,
vcs_modification_markers: bool,
grid: bool,
rule: bool,
line_numbers: bool,
snip: bool,
}
@@ -179,6 +180,12 @@ impl<'a> PrettyPrinter<'a> {
self
}
/// Whether to paint a horizontal rule to delimit files
pub fn rule(&mut self, yes: bool) -> &mut Self {
self.active_style_components.rule = yes;
self
}
/// Whether to show modification markers for VCS changes. This has no effect if
/// the `git` feature is not activated.
#[cfg_attr(
@@ -285,6 +292,9 @@ impl<'a> PrettyPrinter<'a> {
if self.active_style_components.grid {
style_components.push(StyleComponent::Grid);
}
if self.active_style_components.rule {
style_components.push(StyleComponent::Rule);
}
if self.active_style_components.header {
style_components.push(StyleComponent::Header);
}