Package org.jline.builtins
Class Completers.TreeCompleter
java.lang.Object
org.jline.builtins.Completers.TreeCompleter
- All Implemented Interfaces:
org.jline.reader.Completer
- Enclosing class:
Completers
A completer that supports hierarchical command structures.
This completer allows defining a tree of command nodes, where each node can have its own completer and child nodes. It's useful for implementing command hierarchies where different completions are available at different levels of the command structure.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Represents a node in the completion tree. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TreeCompleter with the specified list of nodes.TreeCompleter
(Completers.TreeCompleter.Node... nodes) Creates a new TreeCompleter with the specified nodes. -
Method Summary
-
Constructor Details
-
TreeCompleter
Creates a new TreeCompleter with the specified nodes.- Parameters:
nodes
- the root nodes of the completion tree
-
TreeCompleter
Creates a new TreeCompleter with the specified list of nodes.- Parameters:
nodes
- the list of root nodes of the completion tree
-
-
Method Details
-
node
Creates a new node for the completion tree.This method accepts various types of objects and constructs a node based on their types:
- String objects are converted to Candidate objects
- Candidate objects are used directly
- Node objects are added as child nodes
- Completer objects are used as the node's completer
- Parameters:
objs
- the objects to include in the node- Returns:
- a new Node instance
- Throws:
IllegalArgumentException
- if the objects cannot form a valid node
-
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 using the tree structure.Delegates to the RegexCompleter which handles the tree structure.
- Specified by:
complete
in interfaceorg.jline.reader.Completer
- Parameters:
reader
- the line readerline
- the parsed command linecandidates
- the list to add completion candidates to
-