Interface LineExpander

All Known Implementing Classes:
DefaultLineExpander
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface LineExpander
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 Type
    Method
    Description
    expand(String line, CommandSession session)
    Expands variables and expressions in the given command line.
  • Method Details

    • expand

      String expand(String line, CommandSession session)
      Expands variables and expressions in the given command line.
      Parameters:
      line - the command line to expand
      session - the current command session (for variable lookup)
      Returns:
      the expanded command line