Class Completers.Completer
java.lang.Object
org.jline.builtins.Completers.Completer
- All Implemented Interfaces:
org.jline.reader.Completer
- Enclosing class:
Completers
A 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
ConstructorsConstructorDescriptionCompleter(Completers.CompletionEnvironment environment) Creates a new Completer with the specified environment. -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete(org.jline.reader.LineReader reader, org.jline.reader.ParsedLine line, List<org.jline.reader.Candidate> candidates) Completes the current input line.protected voidcompleteCommand(List<org.jline.reader.Candidate> candidates) Completes command names.protected voidcompleteCommandArguments(org.jline.reader.LineReader reader, org.jline.reader.ParsedLine line, List<org.jline.reader.Candidate> candidates, List<Completers.CompletionData> completions) Completes command arguments based on completion data.protected voidtryCompleteArguments(org.jline.reader.LineReader reader, org.jline.reader.ParsedLine line, List<org.jline.reader.Candidate> candidates) Attempts to complete command arguments.
-
Constructor Details
-
Completer
Creates a new Completer with the specified environment.- Parameters:
environment- the completion environment to use
-
-
Method Details
-
complete
public void complete(org.jline.reader.LineReader reader, org.jline.reader.ParsedLine line, 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, 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, List<org.jline.reader.Candidate> candidates, 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
Completes command names.Adds completion candidates for all available commands, including their descriptions if available.
- Parameters:
candidates- the list to add completion candidates to
-