Class OptionParsingCommand
- java.lang.Object
- org.springframework.boot.cli.command.AbstractCommand
- org.springframework.boot.cli.command.OptionParsingCommand
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
GrabCommand,InitCommand,InstallCommand,JarCommand,RunCommand,TestCommand,UninstallCommand,WarCommand
public abstract class OptionParsingCommand extends AbstractCommand
Base class for aCommandthat parse options using anOptionHandler.- See Also:
OptionHandler
Constructor Summary
Constructors Modifier Constructor Description protectedOptionParsingCommand(String name, String description, OptionHandler handler)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OptionHandlergetHandler()StringgetHelp()Gets full help text for the command, e.g.Collection<OptionHelp>getOptionsHelp()Returns help for each supported option.ExitStatusrun(String... args)Run the command.Methods inherited from class org.springframework.boot.cli.command.AbstractCommand
getDescription, getExamples, getName, getUsageHelp
Constructor Detail
OptionParsingCommand
protected OptionParsingCommand(String name, String description, OptionHandler handler)
Method Detail
getHelp
public String getHelp()
Description copied from interface:CommandGets full help text for the command, e.g. a longer description and one line per option.- Specified by:
getHelpin interfaceCommand- Overrides:
getHelpin classAbstractCommand- Returns:
- the command's help text
getOptionsHelp
public Collection<OptionHelp> getOptionsHelp()
Description copied from interface:CommandReturns help for each supported option.- Specified by:
getOptionsHelpin interfaceCommand- Overrides:
getOptionsHelpin classAbstractCommand- Returns:
- help for each of the command's options
run
public final ExitStatus run(String... args) throws Exception
Description copied from interface:CommandRun the command.- Parameters:
args- command arguments (this will not include the command itself)- Returns:
- the outcome of the command
- Throws:
Exception- if the command fails
getHandler
protected OptionHandler getHandler()