@Override public int getArgumentPosition() { return line.wordCursor(); }
public int wordCursor() { return line.wordCursor(); } public int wordIndex() {
@Override public int getArgumentPosition() { return line.wordCursor(); }
@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); }
assert candidates != null; String buffer = commandLine.word().substring(0, commandLine.wordCursor());
assert candidates != null; String buffer = commandLine.word().substring(0, commandLine.wordCursor());
assert candidates != null; String buffer = commandLine.word().substring(0, commandLine.wordCursor());
@Override public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { CompletingParsedLine cpl = (line instanceof CompletingParsedLine) ? ((CompletingParsedLine) line) : t -> t; CompletionContext context = new CompletionContext(sanitizeInput(line.words()), line.wordIndex(), line.wordCursor()); List<CompletionProposal> proposals = shell.complete(context); proposals.stream() .map(p -> new Candidate( p.dontQuote() ? p.value() : cpl.emit(p.value()).toString(), p.displayText(), p.category(), p.description(), null, null, true) ) .forEach(candidates::add); }