Skip to content
Myr

Windows: Always enable colors if --color=always is set

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by David Peter · parent d77daa8 · Browse files · 1 file+8 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−4 removed

  • other:+8 added−4 removed

1 file+8 added−4 removed

modified:src/main.rs+8 added-4 removed
146 unmodified lines
147 // if the pattern has an uppercase character (smart case).148 let case_sensitive = !matches.is_present("ignore-case")149 && (matches.is_present("case-sensitive") || pattern_has_uppercase_char(&pattern_regex));150151152 #[cfg(windows)]153 let ansi_colors_support = ansi_term::enable_ansi_support().is_ok();154155 #[cfg(not(windows))]156 let ansi_colors_support = true;157158 let interactive_terminal = atty::is(Stream::Stdout);159 let colored_output = match matches.value_of("color") {160 Some("always") => true,161 Some("never") => false,155 _ => env::var_os("NO_COLOR").is_none() && interactive_terminal,162 _ => ansi_colors_support && env::var_os("NO_COLOR").is_none() && interactive_terminal,163 };164165 let path_separator = matches.value_of("path-separator").map(|str| str.to_owned());166160 #[cfg(windows)]161 let colored_output = colored_output && ansi_term::enable_ansi_support().is_ok();162167 let ls_colors = if colored_output {168 Some(LsColors::from_env().unwrap_or_default())169 } else {170 None
261 unmodified lines