public class CandidateListCompletionHandler extends java.lang.Object implements CompletionHandler
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.Modifier and Type | Class and Description |
---|---|
private static class |
CandidateListCompletionHandler.Messages |
Modifier and Type | Field and Description |
---|---|
private boolean |
printSpaceAfterFullCompletion |
private boolean |
stripAnsi |
Constructor and Description |
---|
CandidateListCompletionHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
complete(ConsoleReader reader,
java.util.List<java.lang.CharSequence> candidates,
int pos) |
boolean |
getPrintSpaceAfterFullCompletion() |
private java.lang.String |
getUnambiguousCompletions(java.util.List<java.lang.CharSequence> candidates)
Returns a root that matches all the
String elements of the specified List ,
or null if there are no commonalities. |
boolean |
isStripAnsi() |
static void |
printCandidates(ConsoleReader reader,
java.util.Collection<java.lang.CharSequence> candidates)
Print out the candidates.
|
static void |
setBuffer(ConsoleReader reader,
java.lang.CharSequence value,
int offset) |
void |
setPrintSpaceAfterFullCompletion(boolean printSpaceAfterFullCompletion) |
void |
setStripAnsi(boolean stripAnsi) |
private static boolean |
startsWith(java.lang.String starts,
java.lang.String[] candidates) |
private boolean printSpaceAfterFullCompletion
private boolean stripAnsi
public boolean getPrintSpaceAfterFullCompletion()
public void setPrintSpaceAfterFullCompletion(boolean printSpaceAfterFullCompletion)
public boolean isStripAnsi()
public void setStripAnsi(boolean stripAnsi)
public boolean complete(ConsoleReader reader, java.util.List<java.lang.CharSequence> candidates, int pos) throws java.io.IOException
complete
in interface CompletionHandler
java.io.IOException
public static void setBuffer(ConsoleReader reader, java.lang.CharSequence value, int offset) throws java.io.IOException
java.io.IOException
public static void printCandidates(ConsoleReader reader, java.util.Collection<java.lang.CharSequence> candidates) throws java.io.IOException
ConsoleReader.getAutoprintThreshold()
, they prompt with a warning.candidates
- the list of candidates to printjava.io.IOException
private java.lang.String getUnambiguousCompletions(java.util.List<java.lang.CharSequence> candidates)
String
elements of the specified List
,
or null if there are no commonalities. For example, if the list contains
foobar, foobaz, foobuz, the method will return foob.private static boolean startsWith(java.lang.String starts, java.lang.String[] candidates)