-
- 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.
@FunctionalInterface public interface ScriptRunnerExecutes a script file line by line through aCommandDispatcher.A
ScriptRunnerreads 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:
DefaultScriptRunner,ShellBuilder.scriptRunner(ScriptRunner)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidexecute(java.nio.file.Path script, CommandSession session, CommandDispatcher dispatcher)Executes a script file.
-
-
-
Method Detail
-
execute
void execute(java.nio.file.Path script, CommandSession session, CommandDispatcher dispatcher) throws java.lang.ExceptionExecutes a script file.- Parameters:
script- the path to the script filesession- the current command sessiondispatcher- the command dispatcher to execute lines through- Throws:
java.lang.Exception- if script execution fails
-
-