- java.lang.Object
-
- picocli.shell.jline2.PicocliJLineCompleter
-
- All Implemented Interfaces:
jline.console.completer.Completer
public class PicocliJLineCompleter extends Object implements jline.console.completer.Completer
Implementation of the JLine 2Completer
interface that generates completion candidates for the specified command line based on theCommandLine.Model.CommandSpec
that thisPicocliJLineCompleter
was constructed with.- Since:
- 3.7
-
-
Constructor Summary
Constructors Constructor Description PicocliJLineCompleter(CommandLine.Model.CommandSpec spec)
Constructs a newPicocliJLineCompleter
for the given command spec.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
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 Detail
-
PicocliJLineCompleter
public PicocliJLineCompleter(CommandLine.Model.CommandSpec spec)
Constructs a newPicocliJLineCompleter
for the given command spec.- Parameters:
spec
- the command specification to generate completions for. Must be non-null
.
-
-
Method Detail
-
complete
public int 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.- 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
-
-