diff --git a/etc/examples/72-color-moved-2.diff b/etc/examples/72-color-moved-2.diff new file mode 100644 index 000000000..69ddc5c87 --- /dev/null +++ b/etc/examples/72-color-moved-2.diff @@ -0,0 +1,8 @@ +diff --git a/file.py b/file.py +index f07db74..3cb162d 100644 +--- a/file.py ++++ b/file.py +@@ -1,2 +1,2 @@ +-class X: pass + class Y: pass ++class X: pass diff --git a/etc/examples/72-color-moved-3.diff b/etc/examples/72-color-moved-3.diff new file mode 100644 index 000000000..a24d447a4 --- /dev/null +++ b/etc/examples/72-color-moved-3.diff @@ -0,0 +1,14 @@ +commit fffb6bf94087c432b6e2e29cab97bf1f8987c641 +Author: Dan Davison +Date: Tue Nov 23 14:51:46 2021 -0500 + + DEBUG + +diff --git a/src/config.rs b/src/config.rs +index efe6adb..9762222 100644 +--- a/src/config.rs ++++ b/src/config.rs +@@ -400,6 +400,7 @@ fn make_blame_palette(blame_palette: Option, is_light_mode: bool) -> Vec ++pub fn user_supplied_option(option: &str, arg_matches: &clap::ArgMatches) -> bool { +@@ -416,29 +433,30 @@ fn make_styles_map(opt: &cli::Opt) -> Option bool { diff --git a/src/cli.rs b/src/cli.rs index bc928291f..1691b7d38 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -429,6 +429,12 @@ pub struct Opt { /// (underline), 'ol' (overline), or the combination 'ul ol'. pub hunk_header_decoration_style: String, + #[structopt(long = "map-styles")] + /// A string specifying a mapping styles encountered in raw input to desired + /// output styles. An example is --map-styles='black cyan => white magenta, + /// red cyan => white blue' + pub map_styles: Option, + /// Format string for git blame commit metadata. Available placeholders are /// "{timestamp}", "{author}", and "{commit}". #[structopt( diff --git a/src/config.rs b/src/config.rs index 1c28d060c..efe6adb0b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -20,6 +20,7 @@ use crate::git_config::{GitConfig, GitConfigEntry}; use crate::minusplus::MinusPlus; use crate::paint::BgFillMethod; use crate::parse_styles; +use crate::style; use crate::style::Style; use crate::tests::TESTING; use crate::utils::bat::output::PagingMode; @@ -105,6 +106,7 @@ pub struct Config { pub line_numbers_style_minusplus: MinusPlus