Enable ANSI support on Windows
@@ -335,6 +335,15 @@ impl App {
pub fn config(&self) -> Result<Config> {
let files = self.files();
+ let colored_output = match self.matches.value_of("color") {
+ Some("always") => true,
+ Some("never") => false,
+ Some("auto") | _ => self.interactive_output,
+ };
+
+ #[cfg(windows)]
+ let colored_output = colored_output && ansi_term::enable_ansi_support().is_ok();
+
Ok(Config {
true_color: is_truecolor_terminal(),
output_components: self.output_components()?,
@@ -349,11 +358,7 @@ impl App {
Some("never") | _ => OutputWrap::None,
}
},
- colored_output: match self.matches.value_of("color") {
- Some("always") => true,
- Some("never") => false,
- Some("auto") | _ => self.interactive_output,
- },
+ colored_output,
paging_mode: match self.matches.value_of("paging") {
Some("always") => PagingMode::Always,
Some("never") => PagingMode::Never,
