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

Implementation of 'bat --diff'

This adds a new `--diff` option that can be used to only show lines
close to Git changes (added/removed/modified lines). The amount of
additional context can be controlled with `--diff-context=N`.

closes #23
This commit is contained in:
sharkdp
2020-04-23 23:39:30 +02:00
committed by David Peter
parent 0064321323
commit 82e7786e74
7 changed files with 145 additions and 36 deletions

View File

@@ -6,7 +6,7 @@ use syntect::parsing::SyntaxReference;
use crate::{
assets::HighlightingAssets,
config::Config,
config::{Config, VisibleLines},
controller::Controller,
error::Result,
input::Input,
@@ -205,7 +205,7 @@ impl<'a> PrettyPrinter<'a> {
/// Specify the lines that should be printed (default: all)
pub fn line_ranges(&mut self, ranges: LineRanges) -> &mut Self {
self.config.line_ranges = ranges;
self.config.visible_lines = VisibleLines::Ranges(ranges);
self
}