@Override public ParsedLine parse(String line, int cursor, ParseContext context) { if (!line.trim().endsWith(EOF_CHARACTER) && context != ParseContext.COMPLETE) { throw new EOFError( -1, -1, "New line without EOF character.", NEW_LINE_PROMPT); } final ArgumentList parsedLine = (ArgumentList) super.parse(line, cursor, context); return new SqlArgumentList( parsedLine.line(), parsedLine.words(), parsedLine.wordIndex(), parsedLine.wordCursor(), parsedLine.cursor(), null, parsedLine.rawWordCursor(), parsedLine.rawWordLength()); }
/** * Override the default JLine 'expandHistory' behavior so that history-referencing expressions * such as '!42' or '!!' will only be processed and replaced if they occur at the beginning of * an input line, even if the input line spans multiple terminal lines. */ @Override public String expandHistory(final History history, final String line) { if (line.startsWith("!") || line.startsWith("^")) { return super.expandHistory(history, line); } return line; }
public Void call() throws IOException { parent.reader.clearScreen(); return null; } }
final Predicate<String> cliLinePredicate ) { final DefaultParser parser = new DefaultParser(); parser.setEofOnEscapedNewLine(true); parser.setEofOnUnclosedQuote(true); parser.setQuoteChars(new char[]{'\''}); parser.setEscapeChars(new char[]{'\\'});
.terminal(terminal) .completer(new PicocliJLineCompleter(cmd.getCommandSpec())) .parser(new DefaultParser()) .build(); commands.setReader(reader);
/** * Read a line from the <i>in</i> {@link InputStream}, and return the line * (without any trailing newlines). * * @param prompt The prompt to issue to the terminal, may be null. * @param rightPrompt The prompt to issue to the right of the terminal, may be null. * @param mask The mask character, <code>null</code> or <code>0</code>. * @param buffer A string that will be set for editing. * @return A line that is read from the terminal, can never be null. */ public String readLine(String prompt, String rightPrompt, Character mask, String buffer) throws UserInterruptException, EndOfFileException { return readLine(prompt, rightPrompt, mask != null ? new SimpleMaskingCallback(mask) : null, buffer); }
@Override public String readMaskedString(String prompt) throws IOException { return console.readLine(prompt, '*'); } }
protected boolean viFindPrevCharSkip() { if ((findChar = vigetkey()) > 0) { findDir = -1; findTailAdd = 1; return vifindchar(false); } return false; }
public int prevChar() { if (cursor <= 0) { return 0; } return atChar(cursor - 1); }
/** * Search forward in history from a given position. * * @param searchTerm substring to search for. * @param startIndex the index from which on to search * @return index where this substring has been found, or -1 else. */ public int searchForwards(String searchTerm, int startIndex) { return searchForwards(searchTerm, startIndex, false); } /**
public void newState(T state) { Node node = new Node(state); current.right = node; node.left = current; current = node; }
/** * Read a line from the <i>in</i> {@link InputStream}, and return the line * (without any trailing newlines). * * @param prompt The prompt to issue to the terminal, may be null. * @return A line that is read from the terminal, can never be null. */ public String readLine(String prompt) throws UserInterruptException, EndOfFileException { return readLine(prompt, null, (MaskingCallback) null, null); }