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); } }
/** * Enables message color (if JAnsi is available). * @param flag */ public static void setColorEnabled( boolean flag ) { if ( JANSI ) { Ansi.setEnabled( flag ); } }
/** * Enables message color (if JAnsi is available). * @param flag */ public static void setColorEnabled( boolean flag ) { if ( JANSI ) { Ansi.setEnabled( flag ); } }
private void initializeColor(boolean useColor) { if (System.console() == null || log.isDebugEnabled()) { useColor = false; } if (useColor) { AnsiConsole.systemInstall(); Ansi.setEnabled(true); } else { Ansi.setEnabled(false); } }
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; }
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; }
public AnsiLogger(final boolean debug, @Nonnull Format format, @Nonnull PrintStream out, @Nonnull PrintStream err) { this.debug = debug; this.format = format; this.out = out; this.err = err; try { if (isOutputInteractive()) { Ansi.setEnabled(true); AnsiConsole.systemInstall(); } else { Ansi.setEnabled(false); } } catch (Throwable t) { // Not running on a distro with standard c library, disable Ansi. Ansi.setEnabled(false); } }
Ansi.setEnabled(!suppressColor); } else { Ansi.setEnabled(false);
@Preference(name = "color") @Option(name = "C", longName = "color") protected void enableAnsiColors(final Boolean flag) { Ansi.setEnabled(flag); }
/** * Start processing the command(s), based on the supplied arguments. */ protected void start(Args args) throws Throwable { if (args.hasOption("h")) { System.out.println("Usage: " + getCommandName() + " [-e] [-f=<file>]|[-]|[COMMAND]"); System.out.println(); System.out.println("Use '" + getCommandName() + " help' for an overview of available commands."); System.exit(0); } Ansi.setEnabled(isAnsiSupported); if (args.hasOption("f")) { try (InputStream in = new FileInputStream(args.getOption("f"))) { execute(new BufferedInputStream(in), System.out, args.hasOption("e")); } } else if (args.argc() == 1 && args.argv(0).equals("-")) { execute(System.in, System.out, args.hasOption("e")); } else if (args.argc() > 0) { execute(args); } else if (!hasConsole) { execute(System.in, System.out, args.hasOption("e")); } else { console(); } }
String format(String format, Object... args) { Ansi ansi = Ansi.ansi(); Ansi.setEnabled(ansiEnabled); switch (mode) { case Hint:
String format(String format, Object... args) { Ansi ansi = Ansi.ansi(); Ansi.setEnabled(ansiEnabled); switch (mode) { case Hint: