public abstract class Command extends Object
Modifier | Constructor and Description |
---|---|
protected |
Command(String name,
String description)
Create a new command with the given name and description.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
configure(net.sourceforge.argparse4j.inf.Subparser subparser)
Configure the command's
Subparser . |
String |
getDescription()
Returns the command's description.
|
String |
getName()
Returns the command's name.
|
void |
onError(Cli cli,
net.sourceforge.argparse4j.inf.Namespace namespace,
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.
|
public final String getName()
public final 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 Exception
bootstrap
- the bootstrap bootstrapnamespace
- the parsed command line namespaceException
- if something goes wrongpublic void onError(Cli cli, net.sourceforge.argparse4j.inf.Namespace namespace, 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 © 2019. All rights reserved.