Class DefaultLineExpander

java.lang.Object
org.jline.shell.impl.DefaultLineExpander
All Implemented Interfaces:
LineExpander

public class DefaultLineExpander extends Object implements LineExpander
Default implementation of LineExpander that provides sane defaults for variable expansion.

Supported expansions:

  • $VAR and ${VAR} — variable expansion from session variables, then System.getenv()
  • ~ at word start — expands to user.home system property
  • Single-quoted regions ('...') are not expanded
  • Double-quoted regions ("...") expand variables

Advanced braced forms:

  • ${VAR:-default} — use default if VAR is unset or empty
  • ${VAR:=default} — assign default if VAR is unset or empty
  • ${VAR:+alt} — use alt if VAR is set and non-empty
  • ${VAR:?error} — error if VAR is unset or empty

Deliberately not included (subclass for these):

  • ${VAR//pattern/replacement} — pattern substitution
  • Glob expansion (*, ?)

Subclasses can override resolve(String, CommandSession) to customize how variable names are resolved.

Since:
4.0
See Also: