接口 Command
- 所有已知实现类:
AbstractCommand
,GrabCommand
,HelpCommand
,HintCommand
,InitCommand
,InstallCommand
,JarCommand
,OptionParsingCommand
,PromptCommand
,RunCommand
,ShellCommand
,TestCommand
,UninstallCommand
,VersionCommand
,WarCommand
public interface Command
A single command that can be run from the CLI.- 另请参阅:
run(String...)
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 String
getDescription()
Returns a description of the command.Collection<HelpExample>
getExamples()
Return some examples for the command.String
getHelp()
Gets full help text for the command, e.g. a longer description and one line per option.String
getName()
Returns the name of the command.Collection<OptionHelp>
getOptionsHelp()
Returns help for each supported option.String
getUsageHelp()
Returns usage help for the command.ExitStatus
run(String... args)
Run the command.
方法详细资料
getDescription
String getDescription()
Returns a description of the command.- 返回:
- the command's description
getUsageHelp
String getUsageHelp()
Returns usage help for the command. This should be a simple one-line string describing basic usage. e.g. '[options] <file>'. Do not include the name of the command in this string.- 返回:
- the command's usage help
getHelp
String getHelp()
Gets full help text for the command, e.g. a longer description and one line per option.- 返回:
- the command's help text
getOptionsHelp
Collection<OptionHelp> getOptionsHelp()
Returns help for each supported option.- 返回:
- help for each of the command's options
getExamples
Collection<HelpExample> getExamples()
Return some examples for the command.- 返回:
- the command's examples
run
ExitStatus run(String... args) throws Exception
Run the command.- 参数:
args
- command arguments (this will not include the command itself)- 返回:
- the outcome of the command
- 抛出:
Exception
- if the command fails