Interface Expander
- All Known Implementing Classes:
DefaultExpander
Expanders are responsible for processing and expanding various types of expressions in the input line before it is executed. This includes:
- History expansions (e.g., !! to repeat the last command)
- Variable expansions (e.g., $HOME or ${HOME})
- Other shell-like expansions
The expander is called by the LineReader after the user has accepted a line but before it is executed or added to the history. This allows the user to see the unexpanded form while editing, but ensures that the expanded form is what gets executed and stored in history.
The default implementation is DefaultExpander
.
- See Also:
-
Method Summary
-
Method Details
-
expandHistory
Expands history references in the input line.This method processes history designators such as !!, !$, !n, etc., replacing them with the corresponding entries from the command history.
- Parameters:
history
- the command history to use for expansionline
- the input line containing history references- Returns:
- the line with history references expanded
-
expandVar
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.
- Parameters:
word
- the word containing variable references- Returns:
- the word with variables expanded
-