ConfiguredCommand
public abstract class Command
extends java.lang.Object
Modifier | Constructor | Description |
---|---|---|
protected |
Command(java.lang.String name,
java.lang.String description) |
Create a new command with the given name and description.
|
Modifier and Type | Method | Description |
---|---|---|
abstract void |
configure(net.sourceforge.argparse4j.inf.Subparser subparser) |
Configure the command's
Subparser . |
java.lang.String |
getDescription() |
Returns the command's description.
|
java.lang.String |
getName() |
Returns the command's name.
|
void |
onError(Cli cli,
net.sourceforge.argparse4j.inf.Namespace namespace,
java.lang.Throwable e) |
Method is called if there is an issue parsing configuration, setting up the
environment, or running the command itself.
|
abstract void |
run(Bootstrap<?> bootstrap,
net.sourceforge.argparse4j.inf.Namespace namespace) |
Executes when the user runs this specific command.
|
protected Command(java.lang.String name, java.lang.String description)
name
- the name of the command, used for command line invocationdescription
- a description of the command's purposepublic final java.lang.String getName()
public final java.lang.String getDescription()
public abstract void configure(net.sourceforge.argparse4j.inf.Subparser subparser)
Subparser
.subparser
- the Subparser
specific to the commandpublic abstract void run(Bootstrap<?> bootstrap, net.sourceforge.argparse4j.inf.Namespace namespace) throws java.lang.Exception
bootstrap
- the bootstrap bootstrapnamespace
- the parsed command line namespacejava.lang.Exception
- if something goes wrongpublic void onError(Cli cli, net.sourceforge.argparse4j.inf.Namespace namespace, java.lang.Throwable e)
cli
- contains the streams for stdout and stderrnamespace
- the parsed arguments from the commandlinee
- The exception that was thrown when setting up or running the commandCopyright © 2018. All rights reserved.