@Override public void setOffset(int offset) { delegate.setOffset(offset); }
@Override public void setOffset(int offset) { delegate.setOffset(offset); }
@Override public void setOffset(int offset) { delegate.setOffset(offset); }
@Override public void complete(CompleterInvocation completerInvocation) { List<String> candidates = new ArrayList<>(); int cursor = new FileLister(completerInvocation.getGivenCompleteValue(), completerInvocation.getAeshContext().getCurrentWorkingDirectory()). findMatchingDirectories(candidates); boolean appendSpace = false; if (candidates.size() == 1) { if (completerInvocation.getGivenCompleteValue().endsWith(candidates.get(0))) { appendSpace = true; } } completerInvocation.addAllCompleterValues(candidates); completerInvocation.setOffset(completerInvocation.getGivenCompleteValue().length() - cursor); completerInvocation.setAppendSpace(appendSpace); }
@Override public void complete(CompleterInvocation completerInvocation) { if (completerInvocation.getGivenCompleteValue().equals("{foo-barb") || completerInvocation.getGivenCompleteValue().equals("{foo-bar b")) { completerInvocation.addCompleterValue("bArg"); // 1 before the cursor. completerInvocation.setOffset(1); } else { completerInvocation.addCompleterValue(completerInvocation.getGivenCompleteValue() + "bArg"); } } }
@Override public void complete(CompleterInvocation completerInvocation) { if (completerInvocation.getGivenCompleteValue().equals("{foo-barb") || completerInvocation.getGivenCompleteValue().equals("{foo-bar b")) { completerInvocation.addCompleterValue("bArg"); // 1 before the cursor. completerInvocation.setOffset(1); } else { completerInvocation.addCompleterValue(completerInvocation.getGivenCompleteValue() + "bArg"); } } }
@Override public void complete(CompleterInvocation completerData) { Grep grep = (Grep) completerData.getCommand(); //the first argument is the pattern, do not autocomplete if (grep.getArguments() != null && grep.getArguments().size() > 0) { CompleteOperation completeOperation = new AeshCompleteOperation(completerData.getAeshContext(), completerData.getGivenCompleteValue(), 0); List<String> candidates = new ArrayList<>(); if (completerData.getGivenCompleteValue() == null) { new FileLister("", completerData.getAeshContext().getCurrentWorkingDirectory()). findMatchingDirectories(candidates); completeOperation.addCompletionCandidates(candidates); } else { int offset = new FileLister(completerData.getGivenCompleteValue(), completerData.getAeshContext().getCurrentWorkingDirectory()). findMatchingDirectories(candidates); completeOperation.addCompletionCandidates(candidates); completeOperation.setOffset(completerData.getGivenCompleteValue().length() - offset); } if (completeOperation.getCompletionCandidates().size() > 1) { completeOperation.removeEscapedSpacesFromCompletionCandidates(); } completerData.setCompleterValuesTerminalString(completeOperation.getCompletionCandidates()); completerData.setOffset(completeOperation.getOffset()); if (completerData.getGivenCompleteValue() != null && completerData.getCompleterValues().size() == 1) { completerData.setAppendSpace(completeOperation.hasAppendSeparator()); } } } }