Class Completers.Completer

  • All Implemented Interfaces:
    org.jline.reader.Completer
    Enclosing class:
    Completers

    public static class Completers.Completer
    extends java.lang.Object
    implements org.jline.reader.Completer
    A completer implementation that provides command and argument completion.

    This completer uses a CompletionEnvironment to provide context-aware completion for commands and their arguments.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void complete​(org.jline.reader.LineReader reader, org.jline.reader.ParsedLine line, java.util.List<org.jline.reader.Candidate> candidates)
      Completes the current input line.
      protected void completeCommand​(java.util.List<org.jline.reader.Candidate> candidates)
      Completes command names.
      protected void completeCommandArguments​(org.jline.reader.LineReader reader, org.jline.reader.ParsedLine line, java.util.List<org.jline.reader.Candidate> candidates, java.util.List<Completers.CompletionData> completions)
      Completes command arguments based on completion data.
      protected void tryCompleteArguments​(org.jline.reader.LineReader reader, org.jline.reader.ParsedLine line, java.util.List<org.jline.reader.Candidate> candidates)
      Attempts to complete command arguments.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Completer

        public Completer​(Completers.CompletionEnvironment environment)
        Creates a new Completer with the specified environment.
        Parameters:
        environment - the completion environment to use
    • Method Detail

      • complete

        public void complete​(org.jline.reader.LineReader reader,
                             org.jline.reader.ParsedLine line,
                             java.util.List<org.jline.reader.Candidate> candidates)
        Completes the current input line.

        If the cursor is at the first word, completes command names. Otherwise, tries to complete command arguments.

        Specified by:
        complete in interface org.jline.reader.Completer
        Parameters:
        reader - the line reader
        line - the parsed command line
        candidates - the list to add completion candidates to
      • tryCompleteArguments

        protected void tryCompleteArguments​(org.jline.reader.LineReader reader,
                                            org.jline.reader.ParsedLine line,
                                            java.util.List<org.jline.reader.Candidate> candidates)
        Attempts to complete command arguments.

        Retrieves completion data for the command and delegates to completeCommandArguments if completion data is available.

        Parameters:
        reader - the line reader
        line - the parsed command line
        candidates - the list to add completion candidates to
      • completeCommandArguments

        protected void completeCommandArguments​(org.jline.reader.LineReader reader,
                                                org.jline.reader.ParsedLine line,
                                                java.util.List<org.jline.reader.Candidate> candidates,
                                                java.util.List<Completers.CompletionData> completions)
        Completes command arguments based on completion data.

        Processes each completion data entry and adds appropriate candidates based on the current command line state and completion conditions.

        Parameters:
        reader - the line reader
        line - the parsed command line
        candidates - the list to add completion candidates to
        completions - the list of completion data to process
      • completeCommand

        protected void completeCommand​(java.util.List<org.jline.reader.Candidate> candidates)
        Completes command names.

        Adds completion candidates for all available commands, including their descriptions if available.

        Parameters:
        candidates - the list to add completion candidates to