Example 1: Any argument of the command line can use file completion.
consoleReader.addCompletor (new ArgumentCompletor ( new {@link 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 {@link SimpleCompletor} (new String [] { "foo", "bar", "baz"})));consoleReader.addCompletor (new ArgumentCompletor ( new {@link 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 {@link NullCompletor}. For example:
consoleReader.addCompletor (new ArgumentCompletor ( new {@link SimpleCompletor} (new String [] { "foo", "bar", "baz"}),new {@link SimpleCompletor} (new String [] { "xxx", "yyy", "xxx"}),new {@link NullCompletor}));
TODO: handle argument quoting and escape characters
@author Marc Prud'hommeaux
|
|
|
|
|
|
|
|
|
|