diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-08-15 09:39:23 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-08-15 09:39:23 -0400 |
commit | 98d1da411e185130fe4c167786107cb90725bdef (patch) | |
tree | ec4c08debf8a854cc2349c8f267742256c9309de /src/options | |
parent | 5f00f29d73b47fa14aa123a7d16ee9622f3eb02b (diff) |
Rearrange
Diffstat (limited to 'src/options')
-rw-r--r-- | src/options/set.rs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/options/set.rs b/src/options/set.rs index e291a450..150246c9 100644 --- a/src/options/set.rs +++ b/src/options/set.rs @@ -467,27 +467,6 @@ fn split_feature_string(features: &str) -> impl Iterator<Item = &str> { features.split_whitespace().rev() } -fn set_true_color(opt: &mut cli::Opt) { - opt.computed.true_color = match opt.true_color.as_ref() { - "always" => true, - "never" => false, - "auto" => is_truecolor_terminal(), - _ => { - eprintln!( - "Invalid value for --24-bit-color option: {} (valid values are \"always\", \"never\", and \"auto\")", - opt.true_color - ); - process::exit(1); - } - }; -} - -fn is_truecolor_terminal() -> bool { - env::get_env_var("COLORTERM") - .map(|colorterm| colorterm == "truecolor" || colorterm == "24bit") - .unwrap_or(false) -} - impl FromStr for cli::InspectRawLines { type Err = Error; fn from_str(s: &str) -> Result<Self, Self::Err> { @@ -562,6 +541,27 @@ fn set_widths( background_color_extends_to_terminal_width; } +fn set_true_color(opt: &mut cli::Opt) { + opt.computed.true_color = match opt.true_color.as_ref() { + "always" => true, + "never" => false, + "auto" => is_truecolor_terminal(), + _ => { + eprintln!( + "Invalid value for --24-bit-color option: {} (valid values are \"always\", \"never\", and \"auto\")", + opt.true_color + ); + process::exit(1); + } + }; +} + +fn is_truecolor_terminal() -> bool { + env::get_env_var("COLORTERM") + .map(|colorterm| colorterm == "truecolor" || colorterm == "24bit") + .unwrap_or(false) +} + fn set_git_config_entries(opt: &mut cli::Opt, git_config: &mut git_config::GitConfig) { // Styles for key in &["color.diff.old", "color.diff.new"] { |