mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Windows: If no color flag is already set
... then do not print a warning message https://github.com/bootandy/dust/issues/87
This commit is contained in:
+14
-9
@@ -20,15 +20,20 @@ static DEFAULT_NUMBER_OF_LINES: usize = 30;
|
|||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn init_color(no_color: bool) -> bool {
|
fn init_color(no_color: bool) -> bool {
|
||||||
// Required for windows 10
|
// If no color is already set do not print a warning message
|
||||||
// Fails to resolve for windows 8 so disable color
|
if no_color {
|
||||||
match ansi_term::enable_ansi_support() {
|
true
|
||||||
Ok(_) => no_color,
|
} else {
|
||||||
Err(_) => {
|
// Required for windows 10
|
||||||
eprintln!(
|
// Fails to resolve for windows 8 so disable color
|
||||||
"This version of Windows does not support ANSI colors, setting no_color flag"
|
match ansi_term::enable_ansi_support() {
|
||||||
);
|
Ok(_) => no_color,
|
||||||
true
|
Err(_) => {
|
||||||
|
eprintln!(
|
||||||
|
"This version of Windows does not support ANSI colors, setting no_color flag"
|
||||||
|
);
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user