final Predicate<String> cliLinePredicate ) { final DefaultParser parser = new DefaultParser(); parser.setEofOnEscapedNewLine(true); parser.setEofOnUnclosedQuote(true); parser.setQuoteChars(new char[]{'\''}); parser.setEscapeChars(new char[]{'\\'});
@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()); }
public void execute(PrintStream out, PrintStream err, String command) throws Exception { ParsedLine line = new DefaultParser().parse(command.trim(), 0); execute(out, err, line.words()); }
.terminal(terminal) .completer(new PicocliJLineCompleter(cmd.getCommandSpec())) .parser(new DefaultParser()) .build(); commands.setReader(reader);
final DefaultParser parser = new DefaultParser() .eofOnEscapedNewLine(true) .eofOnUnclosedQuote(true); lineReader = LineReaderBuilder.builder() .appName(CliConstants.APP_NAME)
if (quoteStart < 0 && isQuoteChar(line, i)) { if (line.charAt(quoteStart) == line.charAt(i) && !isEscaped(line, i)) { if (!isEscapeChar(line, i)) { if (isDelimiter(line, i)) { if (current.length() > 0) { words.add(current.toString()); if (!isEscapeChar(line, i)) { current.append(line.charAt(i)); if (eofOnEscapedNewLine && isEscapeChar(line, line.length() - 1)) { throw new EOFError(-1, -1, "Escaped new line", "newline");
public void execute(PrintStream out, PrintStream err, String command) throws Exception { ParsedLine line = new DefaultParser().parse(command.trim(), 0); execute(out, err, line.words()); }
public JLineConsole(String defaultPath) throws IOException { super(defaultPath); DefaultParser parser = new DefaultParser(); //It will be applied from jline 3.9.1 //parser.setEscapeChars(null); this.terminal = TerminalBuilder.builder().encoding(encoding).build(); this.reader = LineReaderBuilder.builder() .appName(APP_NAME) .parser(parser) .terminal(terminal) .build(); this.commandReader = LineReaderBuilder.builder() .appName(APP_NAME) .completer(commandCompleter) .parser(parser) .terminal(terminal) .build(); }
node("sendcommand", new Completers.TreeCompleter.Node(new AggregateCompleter(new ServerGroupNameCompleter(), new ProxyGroupNameCompleter(), new ServerNameCompleter(), new ProxyNameCompleter()), Collections.emptyList())) ); Parser parser = new DefaultParser(); String prompt = "> "; String rightPrompt = null;