Modifier and Type | Field and Description |
---|---|
static String |
FATAL_ERROR_CODE |
protected ShellCommand |
mArgs |
static String |
NO_CLASS_ERROR_CODE |
static String |
NO_SYSTEM_ERROR_CODE |
Constructor and Description |
---|
BaseCommand() |
Modifier and Type | Method and Description |
---|---|
String |
nextArg()
Return the next argument on the command line, whatever it is; if there are
no arguments left, return null.
|
String |
nextArgRequired()
Return the next argument on the command line, whatever it is; if there are
no arguments left, throws an IllegalArgumentException to report this to the user.
|
String |
nextOption()
Return the next option on the command line -- that is an argument that
starts with '-'.
|
abstract void |
onRun()
Implement the command.
|
abstract void |
onShowUsage(PrintStream out)
Print help text for the command.
|
void |
run(String[] args)
Call to run the command.
|
void |
showError(String message)
Convenience to show usage information to error output along
with an error message.
|
void |
showUsage()
Convenience to show usage information to error output.
|
protected final ShellCommand mArgs
public static final String FATAL_ERROR_CODE
public static final String NO_SYSTEM_ERROR_CODE
public static final String NO_CLASS_ERROR_CODE
public void run(String[] args)
public void showUsage()
public void showError(String message)
public abstract void onShowUsage(PrintStream out)
public String nextOption()
public String nextArg()
public String nextArgRequired()