Package org.jline.builtins
Class Completers.Completer
java.lang.Object
org.jline.builtins.Completers.Completer
- All Implemented Interfaces:
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 TypeMethodDescriptionvoid
complete
(LineReader reader, ParsedLine line, List<Candidate> candidates) Completes the current input line.protected void
completeCommand
(List<Candidate> candidates) Completes command names.protected void
completeCommandArguments
(LineReader reader, ParsedLine line, List<Candidate> candidates, List<Completers.CompletionData> completions) Completes command arguments based on completion data.protected void
tryCompleteArguments
(LineReader reader, ParsedLine line, List<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
Completes the current input line.If the cursor is at the first word, completes command names. Otherwise, tries to complete command arguments.
-
tryCompleteArguments
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(LineReader reader, ParsedLine line, List<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
-