console.setPrompt(EMPTY); if (isNotBlank(lineForWrite)) { socketWriter.write(lineForWrite + "\n");
private void loopForWriter() { try { while (isRunning) { final int c = socketReader.read(); if (c == EOF) { break; } if (c == EOT) { hackingForReDrawPrompt(); console.setPrompt(DEFAULT_PROMPT); console.redrawLine(); } else { out.write(c); } out.flush(); } } catch (IOException e) { err("write fail : %s", e.getMessage()); shutdown(); } }
public static void main(String[] args) { try { ConsoleReader reader = new ConsoleReader(); reader.setPrompt("prompt> "); // set up the completion CliCommands commands = new CliCommands(reader); CommandLine cmd = new CommandLine(commands); reader.addCompleter(new PicocliJLineCompleter(cmd.getCommandSpec())); // start the shell and process input until the user quits with Ctl-D String line; while ((line = reader.readLine()) != null) { ArgumentList list = new WhitespaceArgumentDelimiter().delimit(line, line.length()); CommandLine.run(commands, list.getArguments()); } } catch (Throwable t) { t.printStackTrace(); } } }
reader.setPrompt(getDefaultPrompt()); input = reader.readLine(); if (input == null) {
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
@Override public void prompt() { if (mInteractive) { mConsoleReader.setPrompt("grunt> "); } }
/** * Set the console prompt * * @param prompt * the prompt */ public void prompt(String prompt) { console.setPrompt(prompt); }
/** * Set the console prompt * * @param prompt * the prompt */ public void prompt(String prompt) { console.setPrompt(prompt); }
public void prompt(String prompt) { Preconditions.checkArgument(prompt != null && !prompt.isEmpty(), "Parameter 'prompt' must not be [" + prompt + "]"); reader.setPrompt(prompt); }
@Override public String readLine(final String prompt) throws IOException { console.setPrompt(prompt); return console.readLine(); }
@Override public ExitStatus run(String... args) throws Exception { this.consoleReader.setPrompt(""); this.consoleReader.clearScreen(); return ExitStatus.OK; }
@Override public ExitStatus run(String... args) throws Exception { this.consoleReader.setPrompt(""); this.consoleReader.clearScreen(); return ExitStatus.OK; }
@Override public String readLine(final String prompt) throws IOException { console.setPrompt(prompt); return console.readLine(); }
private void authenticatedShell() throws IOException { console.setPrompt(PROMPT); String line; while ((line = console.readLine()) != null) { // Handle exit command here as we need to close client and channel if (line.trim().equals(EXIT_COMMAND)) { close(); return; } commandBus.run(line); } }
private void updateCLIPrompt(CLIConnectionConfig config) { cli.getReader().setPrompt(getPrompt(config)); }
public JLineCliConsole(InputStream in, PrintStream out, Log logger, Completer completer, String prompt) { try { consoleReader = new ConsoleReader(in, out); consoleReader.setBellEnabled(false); consoleReader.setPrompt(prompt + "> "); this.logger = logger; consoleReader.addCompleter(completer); } catch (IOException ex) { throw new RuntimeException("Unable to create reader to read commands.", ex); } }
protected ConsoleReader createConsoleReaderWhithoutArgs(String enteredUserName) { ConsoleReader consoleReader = null; history = null; try { consoleReader = new ConsoleReader(); consoleReader.setPrompt(getPrompt()); history = new FileHistory(getHistoryFile(enteredUserName)); consoleReader.setHistory(history); } catch (IOException e) { throw new IllegalStateException("Cannot create jline console reader", e); } return consoleReader; }