buff.append(ESCAPE + "7"); } else { buff.append(ANSICodes.save()); buff.append(ANSICodes.gotoxy(row, mostFurtherLeftColNumber)); buff.append(ANSICodes.clreol()); startFrom = 1; buff.append(ANSICodes.gotoxy(row, startFrom)); buff.reverse(message); buff.append(ESCAPE + "8"); } else { buff.append(ANSICodes.restore());
buff.append(ESCAPE + "7"); } else { buff.append(ANSICodes.save()); buff.append(ANSICodes.gotoxy(row, mostFurtherLeftColNumber)); buff.append(ANSICodes.clreol()); startFrom = 1; buff.append(ANSICodes.gotoxy(row, startFrom)); buff.reverse(message); buff.append(ESCAPE + "8"); } else { buff.append(ANSICodes.restore());
public String convert(LoggingEvent event) { if (!ANSI.isEnabled()) { return event.getLevel().toString(); } if (event.getLevel() == Level.FATAL) { return attrib(FG_RED) + event.getLevel().toString() + attrib(OFF); } else if (event.getLevel() == Level.ERROR) { return attrib(FG_RED) + event.getLevel().toString() + attrib(OFF); } else if (event.getLevel() == Level.WARN) { return attrib(FG_YELLOW) + event.getLevel().toString() + ' ' + attrib(OFF); } else if (event.getLevel() == Level.INFO) { return attrib(FG_GREEN) + event.getLevel().toString() + ' ' + attrib(OFF); } else if (event.getLevel() == Level.DEBUG) { return attrib(FG_CYAN) + event.getLevel().toString() + attrib(OFF); } else if (event.getLevel() == Level.TRACE) { return attrib(FG_BLUE) + event.getLevel().toString() + attrib(OFF); } return event.getLevel().toString(); } }
private void promptForEmailAnsi() throws PrompterException, IOException { ANSIBuffer ansiBuffer = new ANSIBuffer(); ansiBuffer.append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.FG_YELLOW)) .append("Would you like to subscribe to the Atlassian developer mailing list?") .append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.OFF)); boolean signUp = promptForBoolean(ansiBuffer.toString(),"Y"); if(signUp) { ANSIBuffer ansiEmailBuffer = new ANSIBuffer(); ansiEmailBuffer.append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.FG_GREEN)) .append("Please enter your email address (leave blank to cancel):") .append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.OFF)); String email = prompter.prompt(ansiEmailBuffer.toString()); if(StringUtils.isNotBlank(email) && EmailValidator.getInstance().isValid(email)) { doSubscribe(email); } } }
@Override public void showWarning(String message) throws PrompterException { String formattedMessage = message; if (useAnsiColor) { ANSIBuffer ansiBuffer = new ANSIBuffer(); ansiBuffer.append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.BOLD)) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.FG_YELLOW)) .append(message) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.OFF)); formattedMessage = ansiBuffer.toString(); } showMessage(formattedMessage); }
@Override public void showInfo(String message) throws PrompterException { String formattedMessage = message; if (useAnsiColor) { ANSIBuffer ansiBuffer = new ANSIBuffer(); ansiBuffer.append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.BOLD)) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.FG_GREEN)) .append(message) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.OFF)); formattedMessage = ansiBuffer.toString(); } showMessage(formattedMessage); }
@Override public void showError(String message) throws PrompterException { String formattedMessage = message; if (useAnsiColor) { ANSIBuffer ansiBuffer = new ANSIBuffer(); ansiBuffer.append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.BOLD)) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.FG_RED)) .append(message) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.OFF)); formattedMessage = ansiBuffer.toString(); } showMessage(formattedMessage); }
public String requiredMessage(String message) { String formattedMessage = message; if (useAnsiColor) { ANSIBuffer ansiBuffer = new ANSIBuffer(); ansiBuffer.append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.BOLD)) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.FG_RED)) .append(message) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.OFF)); formattedMessage = ansiBuffer.toString(); } return formattedMessage; }
protected String requiredMessage(String message) { String formattedMessage = message; if (useAnsiColor) { ANSIBuffer ansiBuffer = new ANSIBuffer(); ansiBuffer.append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.BOLD)) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.FG_RED)) .append(message) .append(ANSIBuffer.ANSICodes .attrib(PrettyPrompter.OFF)); formattedMessage = ansiBuffer.toString(); } return formattedMessage; }
private boolean promptForUpdateAnsi(DefaultArtifactVersion ampsVersionInPom, DefaultArtifactVersion runningVersion) throws PrompterException { ANSIBuffer ansiBuffer = new ANSIBuffer(); ansiBuffer.append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.FG_YELLOW)) .append("You are running SDK version ") .append(runningVersion.toString()) .append(" but your pom is using version ") .append(ampsVersionInPom.toString()) .append("\n") .append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.OFF)) .append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.BOLD)) .append("Would you like to have your pom updated?") .append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.OFF)); return promptForBoolean(ansiBuffer.toString(),"Y"); }
private void promptAnsi(String latestVersion) throws PrompterException { ANSIBuffer ansiBuffer = new ANSIBuffer(); ansiBuffer.append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.FG_YELLOW)) .append("************************************************************") .append("\nVersion " + latestVersion + " of the Atlassian Plugin SDK is now available.\n") .append("Run the atlas-update command to update.\n") .append("************************************************************") .append(ANSIBuffer.ANSICodes.attrib(PrettyPrompter.OFF)); getLogger().warn(ansiBuffer.toString()); // prompter.prompt(ansiBuffer.toString()); }
public Buffer attrib(final int code) { if (isEnabled()) { buff.append(ANSICodes.attrib(code)); } return this; }
@Override public ANSIBuffer reverse(final String str) { if (SystemUtils.IS_OS_WINDOWS) { return super.reverse(str).append(ANSICodes.attrib(esc)); } return super.reverse(str); } };