Package picocli.shell.jline2
Class PicocliJLineCompleter
java.lang.Object
picocli.shell.jline2.PicocliJLineCompleter
- All Implemented Interfaces:
jline.console.completer.Completer
Implementation of the JLine 2
Completer
interface that generates completion
candidates for the specified command line based on the CommandLine.Model.CommandSpec
that
this PicocliJLineCompleter
was constructed with.- Since:
- 3.7
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newPicocliJLineCompleter
for the given command spec. -
Method Summary
Modifier and TypeMethodDescriptionint
complete
(String buffer, int cursor, List<CharSequence> candidates) Populates the specified list with completion candidates for the specified buffer based on the command specification that this shell was constructed with.
-
Constructor Details
-
PicocliJLineCompleter
Constructs a newPicocliJLineCompleter
for the given command spec.- Parameters:
spec
- the command specification to generate completions for. Must be non-null
.
-
-
Method Details
-
complete
Populates the specified list with completion candidates for the specified buffer based on the command specification that this shell was constructed with.- Specified by:
complete
in interfacejline.console.completer.Completer
- Parameters:
buffer
- the command line stringcursor
- the position of the cursor in the command line stringcandidates
- the list to populate with completion candidates that would produce valid options, parameters or subcommands at the cursor position in the command line- Returns:
- the cursor position in the buffer for which the completion will be relative,
or
-1
if no completions are found
-