Package jline.console.completer
Class CandidateListCompletionHandler
java.lang.Object
jline.console.completer.CandidateListCompletionHandler
- All Implemented Interfaces:
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.- Since:
- 2.3
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
complete
(ConsoleReader reader, List<CharSequence> candidates, int pos) boolean
private String
getUnambiguousCompletions
(List<CharSequence> candidates) boolean
static void
printCandidates
(ConsoleReader reader, Collection<CharSequence> candidates) Print out the candidates.static void
setBuffer
(ConsoleReader reader, CharSequence value, int offset) void
setPrintSpaceAfterFullCompletion
(boolean printSpaceAfterFullCompletion) void
setStripAnsi
(boolean stripAnsi) private static boolean
startsWith
(String starts, String[] candidates)
-
Field Details
-
printSpaceAfterFullCompletion
private boolean printSpaceAfterFullCompletion -
stripAnsi
private boolean stripAnsi
-
-
Constructor Details
-
CandidateListCompletionHandler
public CandidateListCompletionHandler()
-
-
Method Details
-
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, List<CharSequence> candidates, int pos) throws IOException - Specified by:
complete
in interfaceCompletionHandler
- Throws:
IOException
-
setBuffer
public static void setBuffer(ConsoleReader reader, CharSequence value, int offset) throws IOException - Throws:
IOException
-
printCandidates
public static void printCandidates(ConsoleReader reader, Collection<CharSequence> candidates) throws 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:
IOException
-
getUnambiguousCompletions
-
startsWith
- Returns:
- true is all the elements of candidates start with starts
-