@Override public void complete(final LineReader reader, final ParsedLine line, final List<Candidate> candidates) { delegate.complete(reader, line, candidates); } }
/** * Perform a completion operation across all aggregated completers. * * The effect is similar to the following code: * <blockquote><pre>{@code completers.forEach(c -> c.complete(reader, line, candidates));}</pre></blockquote> * * @see Completer#complete(LineReader, ParsedLine, List) */ public void complete(LineReader reader, final ParsedLine line, final List<Candidate> candidates) { Objects.requireNonNull(line); Objects.requireNonNull(candidates); completers.forEach(c -> c.complete(reader, line, candidates)); }
private boolean doMatch(String arg, String name) { List<Candidate> candidates = new ArrayList<>(); completers.apply(name).complete(this.reader.get(), new ArgumentLine(arg, arg.length()), candidates); return candidates.stream().anyMatch(c -> c.value().equals(arg)); }
private boolean doMatch(String arg, String name) { List<Candidate> candidates = new ArrayList<>(); completers.apply(name).complete(this.reader.get(), new ArgumentLine(arg, arg.length()), candidates); return candidates.stream().anyMatch(c -> c.value().equals(arg)); }
@Override public synchronized void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { List<String> words = line.words().subList(0, line.wordIndex()); this.reader.set(reader); Set<String> next = matcher.matchPartial(words); for (String n : next) { completers.apply(n).complete(reader, new ArgumentLine(line.word(), line.wordCursor()), candidates); } this.reader.set(null); }
@Override public synchronized void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { List<String> words = line.words().subList(0, line.wordIndex()); this.reader.set(reader); Set<String> next = matcher.matchPartial(words); for (String n : next) { completers.apply(n).complete(reader, new ArgumentLine(line.word(), line.wordCursor()), candidates); } this.reader.set(null); }
@Override public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { final String bufferStr = reader.getBuffer().substring(0).trim(); if (bufferStr.startsWith(SqlLine.COMMAND_PREFIX) && !bufferStr.startsWith(SqlLine.COMMAND_PREFIX + "all") && !bufferStr.startsWith(SqlLine.COMMAND_PREFIX + "sql")) { sqlLine.getCommandCompleter().complete(reader, line, candidates); } else if (sqlLine.getDatabaseConnection() != null && sqlLine.getDatabaseConnection().getSqlCompleter() != null) { sqlLine.getDatabaseConnection().getSqlCompleter() .complete(reader, line, candidates); } } }
@Override public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { String bufferStr = reader.getBuffer().substring(0); if (bufferStr.startsWith(SqlLine.COMMAND_PREFIX) && !bufferStr.startsWith(SqlLine.COMMAND_PREFIX + "all") && !bufferStr.startsWith(SqlLine.COMMAND_PREFIX + "sql")) { sqlLine.getCommandCompleter().complete(reader, line, candidates); } else if (sqlLine.getDatabaseConnection() != null && sqlLine.getDatabaseConnection().getSqlCompleter() != null) { sqlLine.getDatabaseConnection().getSqlCompleter() .complete(reader, line, candidates); } } }
try { if (completer != null) { completer.complete(this, line, candidates);
CommandsCompleter commandsCompleter = new CommandsCompleter(factory, this); Completer completer = (rdr, line, candidates) -> { builtinCompleter.complete(rdr, line, candidates); commandsCompleter.complete(rdr, line, candidates); merge(candidates);
CommandsCompleter commandsCompleter = new CommandsCompleter(factory, this); Completer completer = (rdr, line, candidates) -> { builtinCompleter.complete(rdr, line, candidates); commandsCompleter.complete(rdr, line, candidates); merge(candidates);