diff options
author | sharkdp <davidpeter@web.de> | 2018-09-01 00:01:07 +0200 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2018-09-01 00:23:15 +0200 |
commit | 026273a05c50f9067598ffd6a58b2ad9913f7864 (patch) | |
tree | a91ad792fd5a242aa9e01ee39a035947f6b29f33 | |
parent | 8903b64830a09db249d011d35e0a5537ff4ee0ba (diff) |
Enable ANSI support on Windows
-rw-r--r-- | src/app.rs | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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, |