public class CommandLine
extends java.lang.Object
The central method is handle()
, which calls one of the
various 'handle' methods. The commands listed in OptionsDefinitions.getItwsettingsCommands
are supported. For each supported command, a method handleCOMMANDCommand exists.
This method actually takes action based on the command. Generally, a
printCOMMANDHelp method also exists, and prints out the help message for
that specific command. For example, see handleListCommand()
and printListHelp()
.
CommandLine cli = new CommandLine();
// the string array represents input using the command line
int retVal = cli.handle(new String[] { "help" });
if (retVal == CommandLine.SUCCESS) {
// good!
} else {
// bad!
}
Modifier and Type | Field and Description |
---|---|
static int |
ERROR |
java.lang.String |
PROGRAM_NAME |
static int |
SUCCESS |
Constructor and Description |
---|
CommandLine(net.sourceforge.jnlp.util.optionparser.OptionParser optionParser)
Creates a new instance
|
Modifier and Type | Method and Description |
---|---|
int |
handle()
Handles overall command line arguments.
|
int |
handleCheckCommand()
Handles the 'check' command
|
int |
handleGetCommand()
Handles the 'get' command.
|
int |
handleHelpCommand()
Handle the 'help' command
|
int |
handleInfoCommand()
Handles the 'info' command
|
int |
handleListCommand()
Handles the 'list' command
|
int |
handleResetCommand()
Handles the 'reset' command
|
int |
handleSetCommand()
Handles the 'set' command
|
static void |
main(java.lang.String[] args)
The starting point of the program
|
void |
printCheckHelp()
Prints a help message for the 'check' command
|
void |
printGetHelp()
Prints help message for the get command
|
void |
printInfoHelp()
Print a help message for the 'info' command
|
void |
printListHelp()
Prints help message for the list command
|
void |
printResetHelp()
Prints a help message for the reset command
|
void |
printSetHelp()
Prints the help message for the 'set' command
|
public static final int ERROR
public static final int SUCCESS
public final java.lang.String PROGRAM_NAME
public CommandLine(net.sourceforge.jnlp.util.optionparser.OptionParser optionParser)
optionParser
- used to parse applications argumentspublic int handleHelpCommand()
public void printListHelp()
public int handleListCommand()
public void printGetHelp()
public int handleGetCommand()
public void printSetHelp()
public int handleSetCommand()
public void printResetHelp()
public int handleResetCommand()
public void printInfoHelp()
public int handleInfoCommand()
public void printCheckHelp()
public int handleCheckCommand()
public int handle()
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- the command line arguments to this programjava.lang.Exception
- when it goes wrong