Package org.jline.shell
Interface LineExpander
- All Known Implementing Classes:
ConsoleLineExpander,DefaultLineExpander
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Expands variables and other expressions in a command line before parsing.
A LineExpander operates on the full command line string (not per-word
like Expander). It is called after alias expansion
and before pipeline parsing.
The exact expansion syntax is controlled by the implementation. Users can
provide their own LineExpander to support custom variable syntax,
glob expansion, or other transformations.
Example:
LineExpander expander = (line, session) -> line.replace("$HOME", "/home/user");
- Since:
- 4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionexpand(String line, CommandSession session) Expands variables and expressions in the given command line.
-
Method Details
-
expand
Expands variables and expressions in the given command line.- Parameters:
line- the command line to expandsession- the current command session (for variable lookup)- Returns:
- the expanded command line
-