Class DefaultScriptRunner

java.lang.Object
org.jline.shell.impl.DefaultScriptRunner
All Implemented Interfaces:
ScriptRunner

public class DefaultScriptRunner extends Object implements ScriptRunner
Default implementation of ScriptRunner that reads a script file line by line and executes each line through the dispatcher.

Features:

  • Skips blank lines and lines starting with # (comments)
  • Supports \ line continuation (backslash at end of line joins with the next line)
  • Each complete line is fed to CommandDispatcher.execute(String)
Since:
4.0
See Also:
  • Constructor Details

    • DefaultScriptRunner

      public DefaultScriptRunner()
      Creates a new DefaultScriptRunner.
  • Method Details

    • execute

      public void execute(Path script, CommandSession session, CommandDispatcher dispatcher) throws Exception
      Description copied from interface: ScriptRunner
      Executes a script file.
      Specified by:
      execute in interface ScriptRunner
      Parameters:
      script - the path to the script file
      session - the current command session
      dispatcher - the command dispatcher to execute lines through
      Throws:
      Exception - if script execution fails