Package org.apache.fulcrum.yaafi.cli
Class Getopt
java.lang.Object
org.apache.fulcrum.yaafi.cli.Getopt
Extremely simple command line parsing class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Does the command-line options exist?boolean
getBooleanValue
(String option) Returns the boolean value for the given option.boolean
getBooleanValue
(String option, boolean defaultValue) Returns the boolean value for the given option.getStringValue
(String option) Returns the string value for the given option.getStringValue
(String option, String defaultValue) Returns the string value for the given option.int
length()
-
Constructor Details
-
Getopt
Constructor- Parameters:
args
- the command line parameters
-
Getopt
Constructor.- Parameters:
args
- the command line parametersprefix
- the prefix for command line parameters
-
-
Method Details
-
contains
Does the command-line options exist?- Parameters:
option
- the option we are looking for- Returns:
- is the given option contained in the command line arguments?
-
length
public int length()- Returns:
- the number of command line arguments
-
getStringValue
Returns the string value for the given option.- Parameters:
option
- the option- Returns:
- the associated value
-
getStringValue
Returns the string value for the given option.- Parameters:
option
- the optiondefaultValue
- the default value if the option is not defined- Returns:
- the associated value
-
getBooleanValue
Returns the boolean value for the given option.- Parameters:
option
- the option- Returns:
- the associated value
-
getBooleanValue
Returns the boolean value for the given option.- Parameters:
option
- the optiondefaultValue
- the default value if the option is not defined- Returns:
- the associated value
-