Package org.jline.shell
Interface ScriptRunner
- All Known Implementing Classes:
DefaultScriptRunner
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Executes a script file line by line through a
CommandDispatcher.
A ScriptRunner reads lines from a script file and feeds them
to the dispatcher for execution. The exact behavior (comment handling,
line continuation, error handling) is determined by the implementation.
Example:
ScriptRunner runner = (script, session, dispatcher) -> {
Files.readAllLines(script).forEach(line -> dispatcher.execute(line));
};
- Since:
- 4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(Path script, CommandSession session, CommandDispatcher dispatcher) Executes a script file.
-
Method Details
-
execute
Executes a script file.- Parameters:
script- the path to the script filesession- the current command sessiondispatcher- the command dispatcher to execute lines through- Throws:
Exception- if script execution fails
-