public abstract class AbstractCommand extends ACommand
ACommand that provides more integration
between argument parsing and dependency injections.
To encourage commonality between various commands and simplify the development of new commands,
this subtype handles argument processing via args4j.
Primarily this means you'll be defining your command line options as annotated fields or setter
methods on subtypes. See Option and Argument for more details.
In addition to annotating setters and fields, the argument parsing code also looks for any
injected fields whose type has HasOptions marker interface.
There are several injectable option fragment components (such as Verbose) that contains
this marker interface, and whatever options that these components define also becomes a part of
the recognizable options.
By sharing and reusing such option fragment components, users will see consistent user interfaces and command developers are freed from lower-level option parsing.
| Constructor and Description |
|---|
AbstractCommand() |
| Modifier and Type | Method and Description |
|---|---|
protected org.kohsuke.args4j.CmdLineParser |
createParser() |
protected String |
getUsageMessage() |
abstract int |
main() |
void |
printHelp(List<String> args)
Print out the detailed help of this command.
|
int |
run(List<String> args)
Executes this command.
|
public int run(List<String> args) throws Exception
ACommandprotected org.kohsuke.args4j.CmdLineParser createParser()
public void printHelp(List<String> args)
ACommandprotected String getUsageMessage()
Copyright © 2011-2013. All Rights Reserved.