|
|
|
@ -32,6 +32,8 @@ public abstract class AnsiOutput {
|
|
|
|
|
|
|
|
|
|
private static Boolean consoleAvailable;
|
|
|
|
|
|
|
|
|
|
private static Boolean ansiCapable;
|
|
|
|
|
|
|
|
|
|
private static final String OPERATING_SYSTEM_NAME = System.getProperty("os.name")
|
|
|
|
|
.toLowerCase();
|
|
|
|
|
|
|
|
|
@ -131,12 +133,19 @@ public abstract class AnsiOutput {
|
|
|
|
|
|
|
|
|
|
private static boolean isEnabled() {
|
|
|
|
|
if (enabled == Enabled.DETECT) {
|
|
|
|
|
return detectIfEnabled();
|
|
|
|
|
return detectIfAnsiCapable();
|
|
|
|
|
}
|
|
|
|
|
return enabled == Enabled.ALWAYS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean detectIfEnabled() {
|
|
|
|
|
private static boolean detectIfAnsiCapable() {
|
|
|
|
|
if (ansiCapable == null) {
|
|
|
|
|
ansiCapable = doDetectIfAnsiCapable();
|
|
|
|
|
}
|
|
|
|
|
return ansiCapable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean doDetectIfAnsiCapable() {
|
|
|
|
|
try {
|
|
|
|
|
if (Boolean.FALSE.equals(consoleAvailable)) {
|
|
|
|
|
return false;
|
|
|
|
|