mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-04 12:22:28 +01:00
Add new style component to separate multiple '--line-range's
This commit is contained in:
@@ -10,6 +10,7 @@ pub enum OutputComponent {
|
||||
Grid,
|
||||
Header,
|
||||
Numbers,
|
||||
Snip,
|
||||
Full,
|
||||
Plain,
|
||||
}
|
||||
@@ -34,11 +35,13 @@ impl OutputComponent {
|
||||
OutputComponent::Grid => &[OutputComponent::Grid],
|
||||
OutputComponent::Header => &[OutputComponent::Header],
|
||||
OutputComponent::Numbers => &[OutputComponent::Numbers],
|
||||
OutputComponent::Snip => &[OutputComponent::Snip],
|
||||
OutputComponent::Full => &[
|
||||
OutputComponent::Changes,
|
||||
OutputComponent::Grid,
|
||||
OutputComponent::Header,
|
||||
OutputComponent::Numbers,
|
||||
OutputComponent::Snip,
|
||||
],
|
||||
OutputComponent::Plain => &[],
|
||||
}
|
||||
@@ -55,6 +58,7 @@ impl FromStr for OutputComponent {
|
||||
"grid" => Ok(OutputComponent::Grid),
|
||||
"header" => Ok(OutputComponent::Header),
|
||||
"numbers" => Ok(OutputComponent::Numbers),
|
||||
"snip" => Ok(OutputComponent::Snip),
|
||||
"full" => Ok(OutputComponent::Full),
|
||||
"plain" => Ok(OutputComponent::Plain),
|
||||
_ => Err(format!("Unknown style '{}'", s).into()),
|
||||
@@ -82,6 +86,10 @@ impl OutputComponents {
|
||||
self.0.contains(&OutputComponent::Numbers)
|
||||
}
|
||||
|
||||
pub fn snip(&self) -> bool {
|
||||
self.0.contains(&OutputComponent::Snip)
|
||||
}
|
||||
|
||||
pub fn plain(&self) -> bool {
|
||||
self.0.iter().all(|c| c == &OutputComponent::Plain)
|
||||
}
|
||||
|
Reference in New Issue
Block a user