public class

ArgumentCompleter

extends Object
implements Completer
java.lang.Object
   ↳ jline.console.completer.ArgumentCompleter

Class Overview

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.

Summary

Nested Classes
class ArgumentCompleter.AbstractArgumentDelimiter Abstract implementation of a delimiter that uses the isDelimiter(CharSequence, int) method to determine if a particular character should be used as a delimiter. 
interface ArgumentCompleter.ArgumentDelimiter The ArgumentCompleter.ArgumentDelimiter allows custom breaking up of a String into individual arguments in order to dispatch the arguments to the nested Completer
class ArgumentCompleter.ArgumentList The result of a delimited buffer. 
class ArgumentCompleter.WhitespaceArgumentDelimiter ArgumentCompleter.ArgumentDelimiter implementation that counts all whitespace (as reported by isWhitespace(char)) as being a delimiter. 
Public Constructors
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 default ArgumentCompleter.WhitespaceArgumentDelimiter.
ArgumentCompleter(List<Completer> completers)
Create a new completer with the default ArgumentCompleter.WhitespaceArgumentDelimiter.
Public Methods
int complete(String buffer, int cursor, List<CharSequence> candidates)
Populates candidates with a list of possible completions for the buffer.
List<Completer> getCompleters()
ArgumentCompleter.ArgumentDelimiter getDelimiter()
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface jline.console.completer.Completer

Public Constructors

public ArgumentCompleter (ArgumentCompleter.ArgumentDelimiter delimiter, Collection<Completer> completers)

Create a new completer with the specified argument delimiter.

Parameters
delimiter The delimiter for parsing arguments
completers The embedded completers

public ArgumentCompleter (ArgumentCompleter.ArgumentDelimiter delimiter, Completer... completers)

Create a new completer with the specified argument delimiter.

Parameters
delimiter The delimiter for parsing arguments
completers The embedded completers

public ArgumentCompleter (Completer... completers)

Create a new completer with the default ArgumentCompleter.WhitespaceArgumentDelimiter.

Parameters
completers The embedded completers

public ArgumentCompleter (List<Completer> completers)

Create a new completer with the default ArgumentCompleter.WhitespaceArgumentDelimiter.

Parameters
completers The embedded completers

Public Methods

public int complete (String buffer, int cursor, List<CharSequence> candidates)

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 the List before returning.

Parameters
buffer The buffer
cursor The current position of the cursor in the buffer
candidates The List of candidates to populate
Returns
  • The index of the buffer for which the completion will be relative

public List<Completer> getCompleters ()

public ArgumentCompleter.ArgumentDelimiter getDelimiter ()

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.

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.