Package org.jline.builtins
Class Completers.Completer
- java.lang.Object
-
- org.jline.builtins.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.CompleterA completer implementation that provides command and argument completion.This completer uses a CompletionEnvironment to provide context-aware completion for commands and their arguments.
-
-
Constructor Summary
Constructors Constructor Description Completer(Completers.CompletionEnvironment environment)Creates a new Completer with the specified environment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomplete(org.jline.reader.LineReader reader, org.jline.reader.ParsedLine line, java.util.List<org.jline.reader.Candidate> candidates)Completes the current input line.protected voidcompleteCommand(java.util.List<org.jline.reader.Candidate> candidates)Completes command names.protected voidcompleteCommandArguments(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 voidtryCompleteArguments(org.jline.reader.LineReader reader, org.jline.reader.ParsedLine line, java.util.List<org.jline.reader.Candidate> candidates)Attempts to complete command arguments.
-
-
-
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:
completein interfaceorg.jline.reader.Completer- Parameters:
reader- the line readerline- the parsed command linecandidates- 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 readerline- the parsed command linecandidates- 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 readerline- the parsed command linecandidates- the list to add completion candidates tocompletions- 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
-
-