summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-11-24 06:58:26 -0500
committerDan Davison <dandavison7@gmail.com>2021-11-24 07:04:20 -0500
commitdba418057eccf5b64586d8b58a878256e53dff63 (patch)
treead20541de6832f7bbde88b58d5b6ba593201ee54 /src/config.rs
parent4f4cd1493ee5a6260136cdce4d3bfd4aa69db4b7 (diff)
Support style names in --map-styles
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/config.rs b/src/config.rs
index efe6adb0..5e5dad41 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -159,7 +159,7 @@ impl Config {
impl From<cli::Opt> for Config {
fn from(opt: cli::Opt) -> Self {
let styles = parse_styles::parse_styles(&opt);
- let styles_map = make_styles_map(&opt);
+ let styles_map = parse_styles::parse_styles_map(&opt);
let max_line_distance_for_naively_paired_lines =
env::get_env_var("DELTA_EXPERIMENTAL_MAX_LINE_DISTANCE_FOR_NAIVELY_PAIRED_LINES")
@@ -400,28 +400,6 @@ fn make_blame_palette(blame_palette: Option<String>, is_light_mode: bool) -> Vec
}
}
-fn make_styles_map(opt: &cli::Opt) -> Option<HashMap<style::AnsiTermStyleEqualityKey, Style>> {
- if let Some(styles_map_str) = &opt.map_styles {
- let mut styles_map = HashMap::new();
- for pair_str in styles_map_str.split(',') {
- let mut style_strs = pair_str.split("=>").map(|s| s.trim());
- if let (Some(from_str), Some(to_str)) = (style_strs.next(), style_strs.next()) {
- let key = style::ansi_term_style_equality_key(
- Style::from_str(from_str, None, None, true, opt.git_config.as_ref())
- .ansi_term_style,
- );
- styles_map.insert(
- key,
- Style::from_str(to_str, None, None, true, opt.git_config.as_ref()),
- );
- }
- }
- Some(styles_map)
- } else {
- None
- }
-}
-
/// Did the user supply `option` on the command line?
pub fn user_supplied_option(option: &str, arg_matches: &clap::ArgMatches) -> bool {
arg_matches.occurrences_of(option) > 0