@Override public String readLine() { final String line = lineReader.readLine(prompt); addToHistory(line); return line; }
line = lineReader.readLine(prompt, null, (MaskingCallback) null, null); } catch (UserInterruptException e) {
final String line = reader.readLine(PROMPT); if (StringUtils.isBlank(line)) { continue;
while (true) { try { line = reader.readLine(prompt, rightPrompt, (MaskingCallback) null, null); ParsedLine pl = reader.getParser().parse(line, 0); String[] arguments = pl.words().toArray(new String[0]);
@Override public void run() { isStarted = true; LineReader lineReader = LineReaderBuilder .builder() .build(); while (true) { try { String line = lineReader.readLine("coffee-gb> "); for (Command cmd : commands) { if (cmd.getPattern().matches(line)) { ParsedCommandLine parsed = cmd.getPattern().parse(line); commandBuffer.add(new CommandExecution(cmd, parsed)); semaphore.acquire(); } } } catch (IllegalArgumentException e) { System.err.println(e.getMessage()); } catch (UserInterruptException e) { System.exit(0); } catch (InterruptedException e) { LOG.error("Interrupted", e); break; } } }
private String readLine(String prompt, boolean echo) { return reader.readLine(prompt + " ", echo ? null : '\0'); } }
private String readLine(String prompt, boolean echo) { return reader.readLine(prompt + " ", echo ? null : '\0'); } }
public String prompt(String prompt, String defaultValue, boolean echo) { String answer = lineReader.readLine(prompt + ": ", '*'); return "".equals(answer) ? defaultValue : answer; }
/** * Loops until one of the {@code options} is provided. Pressing return is equivalent to * returning {@code defaultValue}. */ public String promptWithOptions(String prompt, String defaultValue, String... options) { List<String> optionsAsList = Arrays.asList(options); String answer; do { answer = lineReader.readLine(String.format("%s %s: ", prompt, optionsAsList)); } while (!optionsAsList.contains(answer) && !"".equals(answer)); return "".equals(answer) && !optionsAsList.contains("") ? defaultValue : answer; }
@Override public String readPassword(String prompt) { try { return reader.readLine(prompt, MASK_CHAR); } catch (EndOfFileException | UserInterruptException e) { throw new ConsoleTerminatedException(); } }
private String readMultiLine(String line) { if (line == null) { line = reader.readLine("> ").trim(); } if (line.endsWith(MULTILINE_DELIMITER)) { line = line.substring(0, line.length() - MULTILINE_DELIMITER.length()) + ActivityContext.LINE_SEPARATOR + readMultiLine(null); } return line; }
public boolean confirm(String prompt) { return "yes".equalsIgnoreCase(getReader().readLine(prompt)); }
private String promptMessageToUser(CommandSession session, String msg) throws IOException { LineReader reader = (LineReader) session.get(".jline.reader"); return reader.readLine(msg, null); }
/** * This method allow you to prompt a message to the user. * No control is done on the answer provided by the user. * * @param session the shell's session * @param msg String message to prompt * @return the user answer * @throws IOException */ public static String promptMessageToUser(Session session, String msg) throws IOException { LineReader reader = (LineReader) session.get(".jline.reader"); return reader.readLine(msg, null); }
private String promptMessageToUser(Session session, String msg) throws IOException { LineReader reader = (LineReader) session.get(".jline.reader"); return reader.readLine(msg, null); }
@Override public String readLine(String prompt) { try { String line = reader.readLine(prompt); return readMultiLine(line); } catch (EndOfFileException | UserInterruptException e) { throw new ConsoleTerminatedException(); } }
private void processUserInput(LineReader reader, IntConsumer exitCallback) { while (true) { try { handleUserInput(reader.readLine(prompt).trim()); } catch (InterruptedException ex) { Thread.interrupted(); ConsoleIO.writeOutput(ex.getMessage()); exitCallback.accept(0); break; } catch (ShellException ex) { ConsoleIO.writeOutput(ex.getMessage()); } } }
private boolean unlock (CLIContext cli) throws NoSuchPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, NoSuchProviderException, InvalidKeyException { return cs.unlock(new SensitiveString(cli.getReader().readLine("Password: ", '*'))); } }
@Override public String readLine(String prompt, Character mask) throws IOException { LineReader reader = LineReaderBuilder.builder() .terminal(jlineTerminal) .appName("karaf") .parser((line, cursor, context) -> new SimpleParsedLine(line, cursor)) .build(); reader.setOpt(LineReader.Option.DISABLE_EVENT_EXPANSION); reader.setVariable(LineReader.DISABLE_HISTORY, Boolean.TRUE); reader.setVariable(LineReader.DISABLE_COMPLETION, Boolean.TRUE); return reader.readLine(prompt, mask); }
@Override public String readLine(String prompt, Character mask) throws IOException { LineReader reader = LineReaderBuilder.builder() .terminal(jlineTerminal) .appName("karaf") .parser((line, cursor, context) -> new SimpleParsedLine(line, cursor)) .build(); reader.setOpt(LineReader.Option.DISABLE_EVENT_EXPANSION); reader.setVariable(LineReader.DISABLE_HISTORY, Boolean.TRUE); reader.setVariable(LineReader.DISABLE_COMPLETION, Boolean.TRUE); return reader.readLine(prompt, mask); }