Package org.flasby.cli
Interface Option
- All Known Subinterfaces:
Flag
,OptionList
public interface Option
defines a command line option. Options may be mandatory, can have a default
value which is provided if the commandline option is not specified, and has
a description key associated with it.
- Author:
- flasbyst
-
Method Summary
Modifier and TypeMethodDescriptionreturns a default if one is defined, null otherwise.return the MLS key used to render the description of this option.getOpt()
returns the option to be set on the command line.boolean
if this option is mandatory.
-
Method Details
-
isMandatory
boolean isMandatory()if this option is mandatory. Note that a mandatory option requires an argument otherwise theres no point in making it mandatory. -
getDefaultValue
String getDefaultValue()returns a default if one is defined, null otherwise. This will only be available for a non mandatory option. -
getDescriptionKey
String getDescriptionKey()return the MLS key used to render the description of this option. This would be typically looked up in a resource bundle. SeeMessage
for a handy way of doing this. Options uses the Messages class to display the usage string. -
getOpt
String getOpt()returns the option to be set on the command line. If the commandline switch was '-x', for example, then this method would return 'x'.
-