Class CompleteOperationImpl
java.lang.Object
org.aesh.readline.completion.CompleteOperationImpl
- All Implemented Interfaces:
CompleteOperation
A payload object to store completion data
- Author:
- Ståle W. Pedersen
-
Constructor Summary
ConstructorsConstructorDescriptionCompleteOperationImpl(String buffer, int cursor) Creates a new CompleteOperationImpl with the given buffer and cursor position. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompletionCandidate(String completionCandidate) Add a completion candidate as a string.voidaddCompletionCandidate(TerminalString completionCandidate) Add a completion candidate.voidaddCompletionCandidates(List<String> completionCandidates) Add multiple completion candidates.voidaddCompletionCandidatesTerminalString(List<TerminalString> completionCandidates) Add multiple completion candidates as TerminalStrings.voiddoAppendSeparator(boolean appendSeparator) Set if this CompletionOperation would allow an separator to be appended.booleanCheck if non-escaped spaces should be ignored.booleanCheck if offset should be ignored.Get the input buffer string.Get the list of completion candidates.intGet the current cursor position.getFormattedCompletion(String completion) Get the formatted version of a completion string.Get the formatted completion candidates as strings.Get the formatted completion candidates as TerminalStrings.Returns the original non-trimmed buffer.intGet the offset for completion.charGet the separator character, by default its spaceintReturns the number of characters that were trimmed from the buffer.booleanDo this completion allow for appending a separator after completion?booleanCheck if starts-with matching should be ignored.booleanChecks if the buffer has been trimmed.voidRemove escaped spaces from all completion candidates.voidsetCompletionCandidates(List<String> completionCandidates) Sets the completion candidates from a list of strings.voidsetCompletionCandidatesTerminalString(List<TerminalString> completionCandidates) Sets the completion candidates from a list of TerminalString objects.voidsetIgnoreNonEscapedSpace(boolean ignoreNonEscapedSpace) Set whether to ignore non-escaped spaces.voidsetIgnoreOffset(boolean ignoreOffset) Set whether to ignore the offset.voidsetIgnoreStartsWith(boolean ignoreStartsWith) Set whether to ignore starts-with matching.voidsetOffset(int offset) Set the offset for completion.voidsetSeparator(char separator) By default the separator is one space char, but it can be overridden here.toString()
-
Constructor Details
-
CompleteOperationImpl
Creates a new CompleteOperationImpl with the given buffer and cursor position.- Parameters:
buffer- the input buffer to completecursor- the cursor position in the buffer
-
-
Method Details
-
getBuffer
Description copied from interface:CompleteOperationGet the input buffer string.- Specified by:
getBufferin interfaceCompleteOperation- Returns:
- the buffer content
-
isTrimmed
public boolean isTrimmed()Checks if the buffer has been trimmed.- Returns:
- true if the buffer was trimmed, false otherwise
-
getTrimmedSize
public int getTrimmedSize()Returns the number of characters that were trimmed from the buffer.- Returns:
- the difference in length between the non-trimmed and trimmed buffer
-
getNonTrimmedBuffer
Returns the original non-trimmed buffer.- Returns:
- the non-trimmed buffer string
-
getCursor
public int getCursor()Description copied from interface:CompleteOperationGet the current cursor position.- Specified by:
getCursorin interfaceCompleteOperation- Returns:
- the cursor position
-
getOffset
public int getOffset()Description copied from interface:CompleteOperationGet the offset for completion.- Specified by:
getOffsetin interfaceCompleteOperation- Returns:
- the offset
-
setOffset
public void setOffset(int offset) Description copied from interface:CompleteOperationSet the offset for completion.- Specified by:
setOffsetin interfaceCompleteOperation- Parameters:
offset- the offset value
-
setIgnoreOffset
public void setIgnoreOffset(boolean ignoreOffset) Description copied from interface:CompleteOperationSet whether to ignore the offset.- Specified by:
setIgnoreOffsetin interfaceCompleteOperation- Parameters:
ignoreOffset- true to ignore offset
-
doIgnoreOffset
public boolean doIgnoreOffset()Description copied from interface:CompleteOperationCheck if offset should be ignored.- Specified by:
doIgnoreOffsetin interfaceCompleteOperation- Returns:
- true if offset is ignored
-
getSeparator
public char getSeparator()Get the separator character, by default its space- Specified by:
getSeparatorin interfaceCompleteOperation- Returns:
- separator
-
setSeparator
public void setSeparator(char separator) By default the separator is one space char, but it can be overridden here.- Specified by:
setSeparatorin interfaceCompleteOperation- Parameters:
separator- separator
-
hasAppendSeparator
public boolean hasAppendSeparator()Do this completion allow for appending a separator after completion? By default this is true.- Specified by:
hasAppendSeparatorin interfaceCompleteOperation- Returns:
- appendSeparator
-
doAppendSeparator
public void doAppendSeparator(boolean appendSeparator) Set if this CompletionOperation would allow an separator to be appended. By default this is true.- Specified by:
doAppendSeparatorin interfaceCompleteOperation- Parameters:
appendSeparator- appendSeparator
-
getCompletionCandidates
Description copied from interface:CompleteOperationGet the list of completion candidates.- Specified by:
getCompletionCandidatesin interfaceCompleteOperation- Returns:
- the completion candidates
-
setCompletionCandidates
-
setCompletionCandidatesTerminalString
Sets the completion candidates from a list of TerminalString objects.- Parameters:
completionCandidates- the list of TerminalString completion candidates
-
addCompletionCandidate
Description copied from interface:CompleteOperationAdd a completion candidate.- Specified by:
addCompletionCandidatein interfaceCompleteOperation- Parameters:
completionCandidate- the candidate to add
-
addCompletionCandidate
Description copied from interface:CompleteOperationAdd a completion candidate as a string.- Specified by:
addCompletionCandidatein interfaceCompleteOperation- Parameters:
completionCandidate- the candidate to add
-
addCompletionCandidates
Description copied from interface:CompleteOperationAdd multiple completion candidates.- Specified by:
addCompletionCandidatesin interfaceCompleteOperation- Parameters:
completionCandidates- the candidates to add
-
addCompletionCandidatesTerminalString
Description copied from interface:CompleteOperationAdd multiple completion candidates as TerminalStrings.- Specified by:
addCompletionCandidatesTerminalStringin interfaceCompleteOperation- Parameters:
completionCandidates- the candidates to add
-
removeEscapedSpacesFromCompletionCandidates
public void removeEscapedSpacesFromCompletionCandidates()Description copied from interface:CompleteOperationRemove escaped spaces from all completion candidates.- Specified by:
removeEscapedSpacesFromCompletionCandidatesin interfaceCompleteOperation
-
getFormattedCompletionCandidates
Description copied from interface:CompleteOperationGet the formatted completion candidates as strings.- Specified by:
getFormattedCompletionCandidatesin interfaceCompleteOperation- Returns:
- the formatted candidates
-
getFormattedCompletionCandidatesTerminalString
Description copied from interface:CompleteOperationGet the formatted completion candidates as TerminalStrings.- Specified by:
getFormattedCompletionCandidatesTerminalStringin interfaceCompleteOperation- Returns:
- the formatted candidates
-
getFormattedCompletion
Description copied from interface:CompleteOperationGet the formatted version of a completion string.- Specified by:
getFormattedCompletionin interfaceCompleteOperation- Parameters:
completion- the completion to format- Returns:
- the formatted completion
-
isIgnoreStartsWith
public boolean isIgnoreStartsWith()Description copied from interface:CompleteOperationCheck if starts-with matching should be ignored.- Specified by:
isIgnoreStartsWithin interfaceCompleteOperation- Returns:
- true if starts-with is ignored
-
setIgnoreStartsWith
public void setIgnoreStartsWith(boolean ignoreStartsWith) Description copied from interface:CompleteOperationSet whether to ignore starts-with matching.- Specified by:
setIgnoreStartsWithin interfaceCompleteOperation- Parameters:
ignoreStartsWith- true to ignore starts-with
-
doIgnoreNonEscapedSpace
public boolean doIgnoreNonEscapedSpace()Description copied from interface:CompleteOperationCheck if non-escaped spaces should be ignored.- Specified by:
doIgnoreNonEscapedSpacein interfaceCompleteOperation- Returns:
- true if non-escaped spaces are ignored
-
setIgnoreNonEscapedSpace
public void setIgnoreNonEscapedSpace(boolean ignoreNonEscapedSpace) Description copied from interface:CompleteOperationSet whether to ignore non-escaped spaces.- Specified by:
setIgnoreNonEscapedSpacein interfaceCompleteOperation- Parameters:
ignoreNonEscapedSpace- true to ignore non-escaped spaces
-
toString
-