@Override public ANSIBuffer reverse(final String str) { if (SystemUtils.IS_OS_WINDOWS) { return super.reverse(str).append(ANSICodes.attrib(esc)); } return super.reverse(str); } };
private void doAnsiFlash(final int row, final Level level, final String message) { final ANSIBuffer buff = JLineLogHandler.getANSIBuffer(); if (APPLE_TERMINAL) { 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());
sb.append(getANSIBuffer().reverse(threadName).green(eventString)); } else { sb.append(getANSIBuffer().reverse(threadName).append(eventString));
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"); }
formatted.append(message); formatted.append(" ("); formatted.append("/"); formatted.append(")"); formatted.append(ANSIBuffer.ANSICodes .attrib(FG_GREEN)) .append(ANSIBuffer.ANSICodes .attrib(BOLD)) .append(" [") .append(defaultReply) .append("]") .append(ANSIBuffer.ANSICodes .attrib(OFF)); formatted.append(": "); return formatted.toString();
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; }
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; }
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()); }
private <T> Pair<String, Map<String, T>> formatAnsiChoiceMessage(String message, Iterable<T> choices, Function<T, String> choiceDisplay) throws PrompterException { ANSIBuffer query = new ANSIBuffer(); query.bold(message + ":\n"); List<String> answers = new ArrayList<>(); Map<String, T> answerValueMap = new HashMap<>(); int counter = 1; for (T choice : choices) { String answer = String.valueOf(counter); query.bold(answer); if (counter < 10) { query.append(": "); } else { query.append(": "); } query.append(choiceDisplay.apply(choice)).append("\n"); answers.add(answer); answerValueMap.put(answer, choice); counter++; } return Pair.of(query.toString(), answerValueMap); }
@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); }
@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 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); }
private MessageAndAnswers formatNumberedAnsiMessage(String message, List<String> possibleValues, String defaultValue) formatted.bold(message).append("\n"); formatted.append(answer); formatted.append(": "); } else formatted.append(": "); formatted.bold(val).append("\n"); formatted.append(val).append("\n");
@Override public ANSIBuffer reverse(final String str) { if (SystemUtils.IS_OS_WINDOWS) { return super.reverse(str).append(ANSICodes.attrib(esc)); } return super.reverse(str); } };
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); } } }
sb.append(getANSIBuffer().reverse(threadName).green(eventString)); } else { sb.append(getANSIBuffer().reverse(threadName).append(eventString));