Package org.jline.reader.impl
Class DefaultExpander
java.lang.Object
org.jline.reader.impl.DefaultExpander
- All Implemented Interfaces:
Expander
Default implementation of the
Expander
interface.
This expander provides functionality for expanding special syntax in command lines, including:
- History expansions (e.g., !!, !$, !n, etc.)
- Variable expansions (e.g., $HOME, ${PATH})
The history expansion syntax is similar to that used in Bash and other shells, allowing users to reference and reuse previous commands or parts of commands.
The expander is used by the LineReader to process the command line after the user has accepted it but before it is executed or added to the history.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexpandHistory
(History history, String line) Expand event designator such as !!, !#, !3, etc...Expands variables in the input word.protected int
searchBackwards
(History history, String searchTerm, int startIndex, boolean startsWith)
-
Constructor Details
-
DefaultExpander
public DefaultExpander()
-
-
Method Details
-
expandHistory
Expand event designator such as !!, !#, !3, etc... See http://www.gnu.org/software/bash/manual/html_node/Event-Designators.html- Specified by:
expandHistory
in interfaceExpander
- Parameters:
history
- the command history to use for expansionline
- the input line containing history references- Returns:
- the line with history references expanded
-
expandVar
Description copied from interface:Expander
Expands variables in the input word.This method processes variable references such as $VAR or ${VAR}, replacing them with their values. The specific syntax and behavior depends on the implementation.
-
searchBackwards
-