|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.cloudbees.sdk.cli.ACommand
com.cloudbees.sdk.cli.AbstractCommand
public abstract class AbstractCommand
Partial implementation of 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 Summary | |
|---|---|
AbstractCommand()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractCommand()
| Method Detail |
|---|
public abstract int main()
throws Exception
Exception
public int run(List<String> args)
throws Exception
ACommand
run in class ACommandargs - Never empty, never null. The first argument is the command name itself,
followed by arguments
Exceptionprotected org.kohsuke.args4j.CmdLineParser createParser()
public void printHelp(List<String> args)
ACommand
printHelp in class ACommandargs - For backward compatibility, this method receives the full argument list
(where the first token is the command name for which the help is requested.)protected String getUsageMessage()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||