public class CommandLine extends Object
| Constructor and Description |
|---|
CommandLine(String[] args)
Construct a command line object
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOption(CommandLineOption option) |
String |
getOptionValue(String argName,
String defaultValue)
Get the value of a given option
|
List<String> |
getParameters() |
boolean |
hasFlag(String flag)
Check to see if a flag was given
|
void |
parse()
Perform the actual parsing of command line arguments
|
void |
setParameters(List<String> parameters) |
void |
usage(String commandLine)
Display the usage for this command line
|
public CommandLine(String[] args)
args - the user entered argumentspublic void addOption(CommandLineOption option)
public void parse()
throws CommandLineParseException
CommandLineParseException - on errorspublic boolean hasFlag(String flag) throws CommandLineParseException
flag - is the flag to checkCommandLineParseException - if the flag was not declared, or the option
is not a flagpublic String getOptionValue(String argName, String defaultValue) throws CommandLineParseException
argName - is the option to checkdefaultValue - is the value if option not foundCommandLineParseException - if the flag was not declared, or the option
is a flagpublic void usage(String commandLine)
commandLine - is the header for the usageCopyright © 2017. All rights reserved.