jline
Class CandidateListCompletionHandler
java.lang.Object
jline.CandidateListCompletionHandler
- All Implemented Interfaces:
- CompletionHandler
public class CandidateListCompletionHandler
- extends java.lang.Object
- implements CompletionHandler
A CompletionHandler that deals with multiple distinct completions
by outputting the complete list of possibilities to the console. This
mimics the behavior of the
readline
library.
TODO:
- handle quotes and escaped quotes
- enable automatic escaping of whitespace
- Author:
- Marc Prud'hommeaux
|
Field Summary |
private boolean |
eagerNewlines
|
private static java.util.ResourceBundle |
loc
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
loc
private static java.util.ResourceBundle loc
eagerNewlines
private boolean eagerNewlines
CandidateListCompletionHandler
public CandidateListCompletionHandler()
setAlwaysIncludeNewline
public void setAlwaysIncludeNewline(boolean eagerNewlines)
complete
public boolean complete(ConsoleReader reader,
java.util.List candidates,
int pos)
throws java.io.IOException
- Specified by:
complete in interface CompletionHandler
- Throws:
java.io.IOException
setBuffer
public static void setBuffer(ConsoleReader reader,
java.lang.String value,
int offset)
throws java.io.IOException
- Throws:
java.io.IOException
printCandidates
public static final void printCandidates(ConsoleReader reader,
java.util.Collection candidates,
boolean eagerNewlines)
throws java.io.IOException
- Print out the candidates. If the size of the candidates
is greated than the
getAutoprintThreshhold,
they prompt with aq warning.
- Parameters:
candidates - the list of candidates to print
- Throws:
java.io.IOException
getUnambiguousCompletions
private final java.lang.String getUnambiguousCompletions(java.util.List candidates)
- Returns a root that matches all the
String elements
of the specified List, or null if there are
no commalities. For example, if the list contains
foobar, foobaz, foobuz, the
method will return foob.
startsWith
private final boolean startsWith(java.lang.String starts,
java.lang.String[] candidates)
- Returns:
- true is all the elements of candidates
start with starts