Class CompletionHandler<C extends CompleteOperation>
java.lang.Object
org.aesh.readline.completion.CompletionHandler<C>
- Type Parameters:
C- the type of complete operation this handler works with
- Direct Known Subclasses:
SimpleCompletionHandler
Abstract handler that manages tab-completion for command line input.
- Author:
- Ståle W. Pedersen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the current status of the completion process. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new CompletionHandler with an empty completion list. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompletion(Completion completion) Adds a completion to the completion list.voidaddCompletions(List<Completion> completions) Adds a list of completions to the completion list.voidclear()Clears all completions from the completion list.voidcomplete(InputProcessor inputProcessor) Display possible completions. 1.Returns the current completion status.abstract CcreateCompleteOperation(String buffer, int cursor) Creates a complete operation for the given buffer and cursor position.static StringfindStartsWithOperation(List<? extends CompleteOperation> coList) If there is any common start string in the completion list, return itintReturns the size threshold for asking before displaying completions.voidremoveCompletion(Completion completion) Removes a completion from the completion list.voidsetAliasHandler(Function<Buffer, C> aliasHandler) Sets the alias handler function for buffer completion.voidsetAskCompletionSize(int size) Sets the size threshold for asking before displaying completions.voidSets the completion status.
-
Constructor Details
-
CompletionHandler
public CompletionHandler()Creates a new CompletionHandler with an empty completion list.
-
-
Method Details
-
addCompletion
Adds a completion to the completion list.- Parameters:
completion- the completion to add
-
removeCompletion
Removes a completion from the completion list.- Parameters:
completion- the completion to remove
-
clear
public void clear()Clears all completions from the completion list. -
completionStatus
Returns the current completion status.- Returns:
- the current completion status
-
setCompletionStatus
Sets the completion status.- Parameters:
status- the completion status to set
-
setAskCompletionSize
public void setAskCompletionSize(int size) Sets the size threshold for asking before displaying completions.- Parameters:
size- the number of completions that triggers confirmation
-
getAskCompletionSize
public int getAskCompletionSize()Returns the size threshold for asking before displaying completions.- Returns:
- the completion size threshold
-
setAliasHandler
-
addCompletions
Adds a list of completions to the completion list.- Parameters:
completions- the list of completions to add
-
createCompleteOperation
-
complete
Display possible completions. 1. Find all possible completions 2. If we find only one, display it. 3. If we find more than one, display them, but not more than 100 at once- Parameters:
inputProcessor- the input processor handling the completion
-
findStartsWithOperation
If there is any common start string in the completion list, return it- Parameters:
coList- completion list- Returns:
- common start string
-