A
Completor implementation that invokes a child completor
using the appropriate
separator argument. This
can be used instead of the individual completors having to
know about argument parsing semantics.
Example 1: Any argument of the command line can
use file completion.
consoleReader.addCompletor (new ArgumentCompletor (
new FileNameCompletor ()))
Example 2: The first argument of the command line
can be completed with any of "foo", "bar", or "baz", and remaining
arguments can be completed with a file name.
consoleReader.addCompletor (new ArgumentCompletor (
new SimpleCompletor (new String [] { "foo", "bar", "baz"})));
consoleReader.addCompletor (new ArgumentCompletor (
new FileNameCompletor ()));
When the argument index is past the last embedded completors, the last
completors is always used. To disable this behavior, have the last
completor be a
NullCompletor. For example:
consoleReader.addCompletor (new ArgumentCompletor (
new SimpleCompletor (new String [] { "foo", "bar", "baz"}),
new SimpleCompletor (new String [] { "xxx", "yyy", "xxx"}),
new NullCompletor
));
TODO: handle argument quoting and escape characters
ArgumentCompletor
public ArgumentCompletor(List completors)
Constuctor: create a new completor with the default
argument separator of " ".
completors - the List of completors to use
ArgumentCompletor
public ArgumentCompletor(Completor completor)
Constuctor: create a new completor with the default
argument separator of " ".
completor - the embedded completor
ArgumentCompletor
public ArgumentCompletor(Completor completor,
ArgumentCompletor.ArgumentDelimiter delim) Constuctor: create a new completor with the specified
argument delimiter.
completor - the embedded completordelim - the delimiter for parsing arguments
ArgumentCompletor
public ArgumentCompletor(Completor[] completors)
Constuctor: create a new completor with the default
argument separator of " ".
completors - the embedded argument completors
ArgumentCompletor
public ArgumentCompletor(Completor[] completors,
ArgumentCompletor.ArgumentDelimiter delim) Constuctor: create a new completor with the specified
argument delimiter.
completors - the embedded completorsdelim - the delimiter for parsing arguments