Package org.jline.reader.impl.completer
Class ArgumentCompleter
java.lang.Object
org.jline.reader.impl.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
- Author:
- Marc Prud'hommeaux, Jason Dillon
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionArgumentCompleter
(Collection<Completer> completers) Create a new completer.ArgumentCompleter
(Completer... completers) Create a new completer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
complete
(LineReader reader, ParsedLine line, List<Candidate> candidates) Populates candidates with a list of possible completions for the command line.Returns the list of completers used inside thisArgumentCompleter
.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.void
setStrictCommand
(boolean strictCommand) If true, a completion at argument index N will only succeed if all the completions from 1-(N-1) also succeed.
-
Constructor Details
-
ArgumentCompleter
Create a new completer.- Parameters:
completers
- The embedded completers
-
ArgumentCompleter
Create a new completer.- 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.- Parameters:
strict
- the strict flag
-
setStrictCommand
public void setStrictCommand(boolean strictCommand) If true, a completion at argument index N will only succeed if all the completions from 1-(N-1) also succeed.- Parameters:
strictCommand
- the strictCommand flag
-
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
-
getCompleters
Returns the list of completers used inside thisArgumentCompleter
.- Returns:
- The list of completers.
- Since:
- 2.3
-
complete
Description copied from interface:Completer
Populates candidates with a list of possible completions for the command line. The list of candidates will be sorted and filtered by the LineReader, so that the list of candidates displayed to the user will usually be smaller than the list given by the completer. Thus it is not necessary for the completer to do any matching based on the current buffer. On the contrary, in order for the typo matcher to work, all possible candidates for the word being completed should be returned.
-