Package org.jline.reader.impl.completer
Class ArgumentCompleter
- java.lang.Object
-
- org.jline.reader.impl.completer.ArgumentCompleter
-
- All Implemented Interfaces:
Completer
public class ArgumentCompleter extends java.lang.Object implements Completer
ACompleter
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
Nested Classes Modifier and Type Class Description static class
ArgumentCompleter.ArgumentLine
-
Constructor Summary
Constructors Constructor Description ArgumentCompleter(java.util.Collection<Completer> completers)
Create a new completer.ArgumentCompleter(Completer... completers)
Create a new completer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
complete(LineReader reader, ParsedLine line, java.util.List<Candidate> candidates)
Populates candidates with a list of possible completions for the command line.java.util.List<Completer>
getCompleters()
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 Detail
-
ArgumentCompleter
public ArgumentCompleter(java.util.Collection<Completer> completers)
Create a new completer.- Parameters:
completers
- The embedded completers
-
ArgumentCompleter
public ArgumentCompleter(Completer... completers)
Create a new completer.- Parameters:
completers
- The embedded completers
-
-
Method Detail
-
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
public java.util.List<Completer> getCompleters()
Returns the list of completers used inside thisArgumentCompleter
.- Returns:
- The list of completers.
- Since:
- 2.3
-
complete
public void complete(LineReader reader, ParsedLine line, java.util.List<Candidate> candidates)
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.
-
-