- java.lang.Object
-
- org.jline.reader.impl.completer.ArgumentCompleter
-
- All Implemented Interfaces:
Completer
public class ArgumentCompleter extends Object implements Completer
ACompleterimplementation 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 classArgumentCompleter.ArgumentLine
-
Constructor Summary
Constructors Constructor Description ArgumentCompleter(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 voidcomplete(LineReader reader, ParsedLine line, List<Candidate> candidates)Populates candidates with a list of possible completions for the command line.List<Completer>getCompleters()Returns the list of completers used inside thisArgumentCompleter.booleanisStrict()Returns whether a completion at argument index N will success if all the completions from arguments 0-(N-1) also succeed.voidsetStrict(boolean strict)If true, a completion at argument index N will only succeed if all the completions from 0-(N-1) also succeed.voidsetStrictCommand(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(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 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, List<Candidate> candidates)
Description copied from interface:CompleterPopulates 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.
-
-