Package org.jline.builtins
Class Completers.RegexCompleter
- java.lang.Object
-
- org.jline.builtins.Completers.RegexCompleter
-
- All Implemented Interfaces:
org.jline.reader.Completer
- Enclosing class:
- Completers
public static class Completers.RegexCompleter extends java.lang.Object implements org.jline.reader.Completer
A completer that uses regular expressions to match command patterns.This completer uses a non-deterministic finite automaton (NFA) to match command patterns and provide appropriate completions based on the current state of the command line.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Completers.RegexCompleter.ArgumentLine
A simple implementation of ParsedLine for argument completion.
-
Constructor Summary
Constructors Constructor Description RegexCompleter(java.lang.String syntax, java.util.function.Function<java.lang.String,org.jline.reader.Completer> completers)
Creates a new RegexCompleter with the specified syntax and completers.
-
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 using the regex pattern.
-
-
-
Constructor Detail
-
RegexCompleter
public RegexCompleter(java.lang.String syntax, java.util.function.Function<java.lang.String,org.jline.reader.Completer> completers)
Creates a new RegexCompleter with the specified syntax and completers.- Parameters:
syntax
- the regular expression syntax for command patternscompleters
- a function that provides completers by name
-
-
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 using the regex pattern.Finds all possible next states in the NFA and applies the corresponding completers to generate completion candidates.
- Specified by:
complete
in interfaceorg.jline.reader.Completer
- Parameters:
reader
- the line readerline
- the parsed command linecandidates
- the list to add completion candidates to
-
-