public class CommandRunner extends java.lang.Object implements java.lang.Iterable
Main class used to run org.springframework.boot.cli.command.Commands.
| Constructor and description |
|---|
CommandRunner(java.lang.String name)Create a new CommandRunner instance. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
addCommand(Command command)Add the specified command. |
|
public void |
addCommands(java.lang.Iterable<org.springframework.boot.cli.command.Command> commands)Add the specified commands. |
|
protected void |
afterRun(Command command)Subclass hook called after a command has run. |
|
protected void |
beforeRun(Command command)Subclass hook called before a command is run. |
|
protected boolean |
errorMessage(java.lang.String message) |
|
public Command |
findCommand(java.lang.String name)Find a command by name. |
|
protected final java.util.List<org.springframework.boot.cli.command.Command> |
getCommands() |
|
public java.lang.String |
getName()Return the name of the runner or an empty string. |
|
public boolean |
isOptionCommand(Command command)Returns if the specified command is an option command. |
|
public java.util.Iterator<org.springframework.boot.cli.command.Command> |
iterator() |
|
protected void |
printStackTrace(java.lang.Exception ex) |
|
protected ExitStatus |
run(java.lang.String args)Parse the arguments and run a suitable command. |
|
public int |
runAndHandleErrors(java.lang.String args)Run the appropriate and handle and errors. |
|
public void |
setHiddenCommands(java.lang.Class<?> commandClasses)Set the command classes which should be hidden (i.e. executed but not displayed in the available commands list). |
|
public void |
setOptionCommands(java.lang.Class<?> commandClasses)Set the command classes which should be considered option commands. |
|
protected void |
showUsage() |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Create a new CommandRunner instance.
name - the name of the runner or nullAdd the specified command.
command - the command to add.Add the specified commands.
commands - the commands to addSubclass hook called after a command has run.
command - the command that has runSubclass hook called before a command is run.
command - the command about to runFind a command by name.
name - the name of the commandnull if not foundReturn the name of the runner or an empty string. Non-empty names will include a trailing space character so that they can be used as a prefix.
Returns if the specified command is an option command.
command - the command to testtrue if the command is an option commandParse the arguments and run a suitable command.
args - the argumentsRun the appropriate and handle and errors.
args - the input argumentsSet the command classes which should be hidden (i.e. executed but not displayed in the available commands list).
commandClasses - the classes of hidden commandsSet the command classes which should be considered option commands. An option command is a special type of command that usually makes more sense to present as if it is an option. For example '--version'.
commandClasses - the classes of option commands.