Objects.requireNonNull(candidates); if (line.wordIndex() < 0) { return; if (line.wordIndex() == 0) { addCandidates(topLevelCommandMap.keySet(), candidates); return; if (line.wordIndex() == 1) { final String firstLevel = line.words().get(0); if (line.wordIndex() >= 2) { final String firstLevel = line.words().get(0); final String secondLevel = line.words().get(1); if (line.wordIndex() == 2) { addCandidates(SessionVariable.getAllVariableNames(), candidates); } else if (line.wordIndex() == 3) { final String currWord = line.word(); final String prevWord = line.words().get(line.wordIndex() - 1); if (FILE_COMPLETION_VARS.contains(prevWord)) { final Completers.FileNameCompleter fileNameCompleter = new Completers.FileNameCompleter(); final String prevWord = line.words().get(line.wordIndex() - 1);
AutoComplete.complete(spec, words, line.wordIndex(), 0, line.cursor(),
@Override public int getCursorArgumentIndex() { return line.wordIndex(); }
@Override public int getCursorArgumentIndex() { return line.wordIndex(); }
public int wordIndex() { return line.wordIndex(); } public List<String> words() {
@Override public void complete(LineReader reader, ParsedLine line, List<Candidate> cand) { if (line.wordIndex() == 0 && cand != null) cand.addAll(this.candidates); }
public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { if (line.wordIndex() == 0) { completeCommand(candidates); } else { tryCompleteArguments(reader, line, candidates); } }
public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { if (line.wordIndex() == 0) { completeCommand(candidates); } else { tryCompleteArguments(reader, line, candidates); } }
Objects.requireNonNull(candidates); if (line.wordIndex() < 0) { return; if (line.wordIndex() >= completers.size()) { completer = completers.get(completers.size() - 1); completer = completers.get(line.wordIndex()); for (int i = 0; isStrict() && (i < line.wordIndex()); i++) { Completer sub = completers.get(i >= completers.size() ? (completers.size() - 1) : i); List<? extends CharSequence> args = line.words();
@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) { if (line.wordIndex() == 0) { makeCommandCandidates(line.word(), candidates); makeTransletCandidates(line.word(), candidates); } else if (line.wordIndex() > 0) { String cmd = line.words().get(0); makeOptionCandidates(cmd, line.word(), candidates); } }
for (CompletionData completion : completions) { boolean isOption = line.word().startsWith("-"); String prevOption = line.wordIndex() >= 2 && line.words().get(line.wordIndex() - 1).startsWith("-") ? line.words().get(line.wordIndex() - 1) : null; String key = UUID.randomUUID().toString(); boolean conditionValue = true;
for (CompletionData completion : completions) { boolean isOption = line.word().startsWith("-"); String prevOption = line.wordIndex() >= 2 && line.words().get(line.wordIndex() - 1).startsWith("-") ? line.words().get(line.wordIndex() - 1) : null; String key = UUID.randomUUID().toString(); boolean conditionValue = true;
@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); }