Package org.jline.console.impl
Class ConsoleLineExpander
java.lang.Object
org.jline.console.impl.ConsoleLineExpander
- All Implemented Interfaces:
LineExpander
A
LineExpander backed by a ConsoleEngine's parameter expansion.
This expander supports full ${expression} syntax with Groovy evaluation
(or whatever script engine the ConsoleEngine is configured with), in addition
to simple $variable expansion.
It delegates to ConsoleEngine.expandCommandLine(String) for the
actual expansion logic, which supports script engine evaluation.
Example:
ConsoleEngine engine = ...;
LineExpander expander = new ConsoleLineExpander(engine);
Shell.builder()
.lineExpander(expander)
.build();
- Since:
- 4.0
-
Constructor Summary
ConstructorsConstructorDescriptionConsoleLineExpander(ConsoleEngine engine) Creates a new ConsoleLineExpander backed by the given engine. -
Method Summary
Modifier and TypeMethodDescriptionexpand(String line, CommandSession session) Expands variables and expressions in the given command line.
-
Constructor Details
-
ConsoleLineExpander
Creates a new ConsoleLineExpander backed by the given engine.- Parameters:
engine- the console engine for parameter expansion
-
-
Method Details
-
expand
Description copied from interface:LineExpanderExpands variables and expressions in the given command line.- Specified by:
expandin interfaceLineExpander- Parameters:
line- the command line to expandsession- the current command session (for variable lookup)- Returns:
- the expanded command line
-