|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.tools.CommandUtils
public class CommandUtils
This class contains some static convenience methods for commandline tools.
Field Summary | |
---|---|
static int |
HELP_TEXT_WIDTH
The width of the help text, for automatic text wrap. |
static String |
OPT_VERBOSE
|
Constructor Summary | |
---|---|
CommandUtils()
|
Method Summary | |
---|---|
static void |
addDefaultOptions(org.apache.commons.cli.Options options)
|
static float |
getFloatOption(org.apache.commons.cli.CommandLine line,
String optName,
float defaultValue)
Parse a command line argument as float. |
static int |
getIntOption(org.apache.commons.cli.CommandLine line,
String optName,
int defaultValue)
Parse a command line argument as integer. |
static void |
printHelp(org.apache.commons.cli.Options options,
String toolName,
String helpMsg,
String otherUsageInfo)
Prints a help message for a apache commons-cli based command line tool and terminates the programm. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int HELP_TEXT_WIDTH
public static final String OPT_VERBOSE
Constructor Detail |
---|
public CommandUtils()
Method Detail |
---|
public static void printHelp(org.apache.commons.cli.Options options, String toolName, String helpMsg, String otherUsageInfo)
options
- the options to generate help/usage information fortoolName
- the name of the command line toolhelpMsg
- some further informationotherUsageInfo
- an optional string to append to the usage information (e.g. for additional arguments like input files)public static int getIntOption(org.apache.commons.cli.CommandLine line, String optName, int defaultValue) throws org.apache.commons.cli.ParseException
line
- the parsed command lineoptName
- the option namedefaultValue
- the default value
defaulValue
, if the argument is missing
org.apache.commons.cli.ParseException
- if the argument is not a numberpublic static float getFloatOption(org.apache.commons.cli.CommandLine line, String optName, float defaultValue) throws org.apache.commons.cli.ParseException
line
- the parsed command lineoptName
- the option namedefaultValue
- the default value
defaulValue
, if the argument is missing
org.apache.commons.cli.ParseException
- if the argument is not a numberpublic static void addDefaultOptions(org.apache.commons.cli.Options options)
options
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |