Package jline.console.completer
Class CandidateListCompletionHandler
- java.lang.Object
-
- jline.console.completer.CandidateListCompletionHandler
-
- All Implemented Interfaces:
CompletionHandler
public class CandidateListCompletionHandler extends java.lang.Object implements CompletionHandler
ACompletionHandlerthat deals with multiple distinct completions by outputting the complete list of possibilities to the console. This mimics the behavior of the readline library.- Since:
- 2.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCandidateListCompletionHandler.Messages
-
Field Summary
Fields Modifier and Type Field Description private booleanprintSpaceAfterFullCompletionprivate booleanstripAnsi
-
Constructor Summary
Constructors Constructor Description CandidateListCompletionHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancomplete(ConsoleReader reader, java.util.List<java.lang.CharSequence> candidates, int pos)booleangetPrintSpaceAfterFullCompletion()private java.lang.StringgetUnambiguousCompletions(java.util.List<java.lang.CharSequence> candidates)Returns a root that matches all theStringelements of the specifiedList, or null if there are no commonalities.booleanisStripAnsi()static voidprintCandidates(ConsoleReader reader, java.util.Collection<java.lang.CharSequence> candidates)Print out the candidates.static voidsetBuffer(ConsoleReader reader, java.lang.CharSequence value, int offset)voidsetPrintSpaceAfterFullCompletion(boolean printSpaceAfterFullCompletion)voidsetStripAnsi(boolean stripAnsi)private static booleanstartsWith(java.lang.String starts, java.lang.String[] candidates)
-
-
-
Method Detail
-
getPrintSpaceAfterFullCompletion
public boolean getPrintSpaceAfterFullCompletion()
-
setPrintSpaceAfterFullCompletion
public void setPrintSpaceAfterFullCompletion(boolean printSpaceAfterFullCompletion)
-
isStripAnsi
public boolean isStripAnsi()
-
setStripAnsi
public void setStripAnsi(boolean stripAnsi)
-
complete
public boolean complete(ConsoleReader reader, java.util.List<java.lang.CharSequence> candidates, int pos) throws java.io.IOException
- Specified by:
completein interfaceCompletionHandler- Throws:
java.io.IOException
-
setBuffer
public static void setBuffer(ConsoleReader reader, java.lang.CharSequence value, int offset) throws java.io.IOException
- Throws:
java.io.IOException
-
printCandidates
public static void printCandidates(ConsoleReader reader, java.util.Collection<java.lang.CharSequence> candidates) throws java.io.IOException
Print out the candidates. If the size of the candidates is greater than theConsoleReader.getAutoprintThreshold(), they prompt with a warning.- Parameters:
candidates- the list of candidates to print- Throws:
java.io.IOException
-
getUnambiguousCompletions
private java.lang.String getUnambiguousCompletions(java.util.List<java.lang.CharSequence> candidates)
Returns a root that matches all theStringelements of the specifiedList, or null if there are no commonalities. For example, if the list contains foobar, foobaz, foobuz, the method will return foob.
-
startsWith
private static boolean startsWith(java.lang.String starts, java.lang.String[] candidates)- Returns:
- true is all the elements of candidates start with starts
-
-