Java Code Examples for org.fusesource.jansi.Ansi#setEnabled()

The following examples show how to use org.fusesource.jansi.Ansi#setEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnsiLoggerFacade.java    From jkube with Eclipse Public License 2.0 5 votes vote down vote up
private void initializeColor(boolean useColor) {
    // sl4j simple logger used by Maven seems to escape ANSI escapes on Windows
    this.useAnsi = useColor && System.console() != null && !log.isDebugEnabled() && !isWindows();
    if (useAnsi) {
        AnsiConsole.systemInstall();
        Ansi.setEnabled(true);
    }
    else {
        Ansi.setEnabled(false);
    }
}
 
Example 2
Source File: AnsiLogger.java    From jkube with Eclipse Public License 2.0 5 votes vote down vote up
private void initializeColor(boolean useColor) {
    this.useAnsi = useColor && !log.isDebugEnabled();
    if (useAnsi) {
        AnsiConsole.systemInstall();
        Ansi.setEnabled(true);
    }
    else {
        Ansi.setEnabled(false);
    }
}
 
Example 3
Source File: RequirementsTest.java    From helidon-build-tools with Apache License 2.0 5 votes vote down vote up
@Test
void testAnsiColors() {
    Ansi.setEnabled(true);
    String expected = "This is " + BoldRed.apply("bold red") + " text, and this is " + Cyan.apply("cyan") + " text.";
    try {
        failed("This is $(RED %s) text, and this is $(cyan %s) text.", "bold red", "cyan");
        fail("Should have failed!");
    } catch (RequirementFailure e) {
        assertThat(e.getMessage(), is(expected));
        System.out.println("Got expected message: " + e.getMessage());
    }
}
 
Example 4
Source File: Configuration.java    From updatebot with Apache License 2.0 5 votes vote down vote up
private boolean useAnsiColor() {
    if (!ansiInitialised) {
        this.useAnsi = !isDisableAnsi() && System.console() != null && !isWindows();
        if (useAnsi) {
            //AnsiConsole.systemInstall();
            Ansi.setEnabled(true);
        } else {
            Ansi.setEnabled(false);
        }
        ansiInitialised = true;
    }
    return useAnsi;
}
 
Example 5
Source File: AnsiLogger.java    From docker-maven-plugin with Apache License 2.0 5 votes vote down vote up
private void initializeColor(boolean useColor) {
    this.useAnsi = useColor && !log.isDebugEnabled();
    if (useAnsi) {
        AnsiConsole.systemInstall();
        Ansi.setEnabled(true);
    }
    else {
        Ansi.setEnabled(false);
    }
}
 
Example 6
Source File: MavenColorRenderer.java    From maven-color with MIT License 5 votes vote down vote up
public MavenColorRenderer(String pattern, boolean isActivated) {
    super(pattern);
    if (LOGGER.isDebugEnabled()) {
        System.out.println("Using maven-color v" + Version.current().get() + ".");
    }
    this.isActivated = isActivated;
    if (isActivated) {
        AnsiConsole.systemInstall();
        colorizer = ColorConfiguration.read();
    } else {
        colorizer = new KeepMavenDefaultColor();
    }
    Ansi.setEnabled(isActivated);
}