Class Completers.OptionCompleter

java.lang.Object
org.jline.builtins.Completers.OptionCompleter
All Implemented Interfaces:
Completer
Enclosing class:
Completers

public static class Completers.OptionCompleter extends Object implements Completer
A completer for command options and arguments.

This completer handles completion for command options (both short and long forms) and their values, as well as command arguments. It's designed to be used as part of an ArgumentCompleter for a complete command-line interface.

  • Constructor Details

    • OptionCompleter

      public OptionCompleter(Completer completer, Function<String,Collection<Completers.OptDesc>> commandOptions, int startPos)
      OptionCompleter completes command options and parameters. OptionCompleter should be used as an argument of ArgumentCompleter
      Parameters:
      completer - command parameter completer
      commandOptions - command options descriptions
      startPos - OptionCompleter position in ArgumentCompleter parameters
    • OptionCompleter

      public OptionCompleter(List<Completer> completers, Function<String,Collection<Completers.OptDesc>> commandOptions, int startPos)
      OptionCompleter completes command options and parameters. OptionCompleter should be used as an argument of ArgumentCompleter
      Parameters:
      completers - command parameters completers
      commandOptions - command options descriptions
      startPos - OptionCompleter position in ArgumentCompleter parameters
    • OptionCompleter

      public OptionCompleter(List<Completer> completers, Map<String,List<String>> optionValues, Collection<String> options, int startPos)
      OptionCompleter completes command options and parameters. OptionCompleter should be used as an argument of ArgumentCompleter
      Parameters:
      completers - command parameters completers
      optionValues - command value options as map key and its possible values as map value
      options - command options that do not have value
      startPos - OptionCompleter position in ArgumentCompleter parameters
    • OptionCompleter

      public OptionCompleter(Completer completer, Map<String,List<String>> optionValues, Collection<String> options, int startPos)
      OptionCompleter completes command options and parameters. OptionCompleter should be used as an argument of ArgumentCompleter
      Parameters:
      completer - command parameter completer
      optionValues - command value options as map key and its possible values as map value
      options - command options that do not have value
      startPos - OptionCompleter position in ArgumentCompleter parameters
    • OptionCompleter

      public OptionCompleter(Map<String,List<String>> optionValues, Collection<String> options, int startPos)
      OptionCompleter completes command options and parameters. OptionCompleter should be used as an argument of ArgumentCompleter
      Parameters:
      optionValues - command value options as map key and its possible values as map value
      options - command options that do not have value
      startPos - OptionCompleter position in ArgumentCompleter parameters
    • OptionCompleter

      public OptionCompleter(Completer completer, Collection<Completers.OptDesc> options, int startPos)
      OptionCompleter completes command options and parameters. OptionCompleter should be used as an argument of ArgumentCompleter
      Parameters:
      completer - command parameter completer
      options - command options that do not have value
      startPos - OptionCompleter position in ArgumentCompleter parameters
    • OptionCompleter

      public OptionCompleter(List<Completer> completers, Collection<Completers.OptDesc> options, int startPos)
      OptionCompleter completes command options and parameters. OptionCompleter should be used as an argument of ArgumentCompleter
      Parameters:
      completers - command parameters completers
      options - command options that do not have value
      startPos - OptionCompleter position in ArgumentCompleter parameters
    • OptionCompleter

      public OptionCompleter(Collection<Completers.OptDesc> options, int startPos)
      OptionCompleter completes command options and parameters. OptionCompleter should be used as an argument of ArgumentCompleter
      Parameters:
      options - command options that do not have value
      startPos - OptionCompleter position in ArgumentCompleter parameters
  • Method Details

    • setStartPos

      public void setStartPos(int startPos)
      Sets the start position of this completer in the argument list.
      Parameters:
      startPos - the position of this completer
    • complete

      public void complete(LineReader reader, ParsedLine commandLine, List<Candidate> candidates)
      Completes command options and arguments.

      This method handles completion for:

      • Command options (both short and long forms)
      • Option values (for options that take values)
      • Command arguments (using the appropriate argument completer)
      Specified by:
      complete in interface Completer
      Parameters:
      reader - the line reader
      commandLine - the parsed command line
      candidates - the list to add completion candidates to
      See Also: