mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-10 23:58:30 +01:00
Enable ANSI support on Windows
This commit is contained in:
parent
8903b64830
commit
026273a05c
15
src/app.rs
15
src/app.rs
@ -335,6 +335,15 @@ impl App {
|
|||||||
pub fn config(&self) -> Result<Config> {
|
pub fn config(&self) -> Result<Config> {
|
||||||
let files = self.files();
|
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 {
|
Ok(Config {
|
||||||
true_color: is_truecolor_terminal(),
|
true_color: is_truecolor_terminal(),
|
||||||
output_components: self.output_components()?,
|
output_components: self.output_components()?,
|
||||||
@ -349,11 +358,7 @@ impl App {
|
|||||||
Some("never") | _ => OutputWrap::None,
|
Some("never") | _ => OutputWrap::None,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
colored_output: match self.matches.value_of("color") {
|
colored_output,
|
||||||
Some("always") => true,
|
|
||||||
Some("never") => false,
|
|
||||||
Some("auto") | _ => self.interactive_output,
|
|
||||||
},
|
|
||||||
paging_mode: match self.matches.value_of("paging") {
|
paging_mode: match self.matches.value_of("paging") {
|
||||||
Some("always") => PagingMode::Always,
|
Some("always") => PagingMode::Always,
|
||||||
Some("never") => PagingMode::Never,
|
Some("never") => PagingMode::Never,
|
||||||
|
Loading…
Reference in New Issue
Block a user