Class PicocliJLineCompleter

  • All Implemented Interfaces:
    jline.console.completer.Completer

    public class PicocliJLineCompleter
    extends Object
    implements 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 Detail

      • PicocliJLineCompleter

        public PicocliJLineCompleter​(CommandLine.Model.CommandSpec spec)
        Constructs a new PicocliJLineCompleter 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 interface jline.console.completer.Completer
        Parameters:
        buffer - the command line string
        cursor - the position of the cursor in the command line string
        candidates - 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