Package jline.console.completer
Class ArgumentCompleter
java.lang.Object
jline.console.completer.ArgumentCompleter
- All Implemented Interfaces:
Completer
A
Completer
implementation that invokes a child completer using the appropriate separator argument.
This can be used instead of the individual completers having to know about argument parsing semantics.- Since:
- 2.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Abstract implementation of a delimiter that uses theArgumentCompleter.AbstractArgumentDelimiter.isDelimiter(java.lang.CharSequence, int)
method to determine if a particular character should be used as a delimiter.static interface
TheArgumentCompleter.ArgumentDelimiter
allows custom breaking up of aString
into individual arguments in order to dispatch the arguments to the nestedCompleter
.static class
The result of a delimited buffer.static class
ArgumentCompleter.ArgumentDelimiter
implementation that counts all whitespace (as reported byCharacter.isWhitespace(char)
) as being a delimiter. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ArgumentCompleter.ArgumentDelimiter
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionArgumentCompleter
(List<Completer> completers) Create a new completer with the defaultArgumentCompleter.WhitespaceArgumentDelimiter
.ArgumentCompleter
(ArgumentCompleter.ArgumentDelimiter delimiter, Collection<Completer> completers) Create a new completer with the specified argument delimiter.ArgumentCompleter
(ArgumentCompleter.ArgumentDelimiter delimiter, Completer... completers) Create a new completer with the specified argument delimiter.ArgumentCompleter
(Completer... completers) Create a new completer with the defaultArgumentCompleter.WhitespaceArgumentDelimiter
. -
Method Summary
Modifier and TypeMethodDescriptionint
complete
(String buffer, int cursor, List<CharSequence> candidates) Populates candidates with a list of possible completions for the buffer.boolean
isStrict()
Returns whether a completion at argument index N will success if all the completions from arguments 0-(N-1) also succeed.void
setStrict
(boolean strict) If true, a completion at argument index N will only succeed if all the completions from 0-(N-1) also succeed.
-
Field Details
-
delimiter
-
completers
-
strict
private boolean strict
-
-
Constructor Details
-
ArgumentCompleter
public ArgumentCompleter(ArgumentCompleter.ArgumentDelimiter delimiter, Collection<Completer> completers) Create a new completer with the specified argument delimiter.- Parameters:
delimiter
- The delimiter for parsing argumentscompleters
- The embedded completers
-
ArgumentCompleter
Create a new completer with the specified argument delimiter.- Parameters:
delimiter
- The delimiter for parsing argumentscompleters
- The embedded completers
-
ArgumentCompleter
Create a new completer with the defaultArgumentCompleter.WhitespaceArgumentDelimiter
.- Parameters:
completers
- The embedded completers
-
ArgumentCompleter
Create a new completer with the defaultArgumentCompleter.WhitespaceArgumentDelimiter
.- Parameters:
completers
- The embedded completers
-
-
Method Details
-
setStrict
public void setStrict(boolean strict) If true, a completion at argument index N will only succeed if all the completions from 0-(N-1) also succeed. -
isStrict
public boolean isStrict()Returns whether a completion at argument index N will success if all the completions from arguments 0-(N-1) also succeed.- Returns:
- True if strict.
- Since:
- 2.3
-
getDelimiter
- Since:
- 2.3
-
getCompleters
- Since:
- 2.3
-
complete
Description copied from interface:Completer
Populates candidates with a list of possible completions for the buffer. The candidates list will not be sorted before being displayed to the user: thus, the complete method should sort theList
before returning.
-