@Order(value=-50) public class NonInteractiveShellRunner extends Object implements ShellRunner
ShellRunner
that executes commands without entering interactive shell mode.
Has higher precedence than InteractiveShellRunner
which gives it an opportunity to handle the shell
in non-interactive fashion.
Modifier and Type | Field and Description |
---|---|
static int |
PRECEDENCE
The precedence at which this runner is ordered by the DefaultApplicationRunner - which also controls
the order it is consulted on the ability to handle the current shell.
|
Constructor and Description |
---|
NonInteractiveShellRunner(Shell shell,
ShellContext shellContext) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRun(org.springframework.boot.ApplicationArguments args)
Checks if a particular shell runner can execute.
|
void |
run(org.springframework.boot.ApplicationArguments args)
Execute application.
|
void |
setCommandsFromInputArgs(Function<org.springframework.boot.ApplicationArguments,List<String>> commandsFromInputArgs)
Sets the function that creates the command() to run from the input application arguments.
|
void |
setLineParser(org.jline.reader.Parser lineParser)
Sets the line parser used to parse commands.
|
public static final int PRECEDENCE
public NonInteractiveShellRunner(Shell shell, ShellContext shellContext)
public void setCommandsFromInputArgs(Function<org.springframework.boot.ApplicationArguments,List<String>> commandsFromInputArgs)
commandsFromInputArgs
- function that takes input application arguments and creates zero or more commands
where each command is a string that specifies the command and options
(eg. 'history --file myHistory.txt')public void setLineParser(org.jline.reader.Parser lineParser)
lineParser
- the line parser used to parse commandspublic boolean canRun(org.springframework.boot.ApplicationArguments args)
ShellRunner
canRun
in interface ShellRunner
args
- the application argumentspublic void run(org.springframework.boot.ApplicationArguments args) throws Exception
ShellRunner
run
in interface ShellRunner
args
- the application argumetsException
- in errorsCopyright © 2024. All rights reserved.