- java.lang.Object
-
- io.github.mmm.cli.CliArgument
-
- io.github.mmm.cli.CliOption
-
- Direct Known Subclasses:
CliLongOption,CliShortOption
public abstract class CliOption extends CliArgument
-
-
Field Summary
-
Fields inherited from class io.github.mmm.cli.CliArgument
END_OPTIONS
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisAssignment()booleanisEndOptions()booleanisOption()booleanisValue()-
Methods inherited from class io.github.mmm.cli.CliArgument
get, getNext, getNextOption, getNextValue, getOptionName, getValue, getValues, isLongOption, isShortOption, toString
-
-
-
-
Constructor Detail
-
CliOption
public CliOption(String arg, boolean assignment)
The constructor.- Parameters:
arg- theargument option.assignment- - theassignmentflag.
-
-
Method Detail
-
isAssignment
public boolean isAssignment()
- Returns:
trueif this option was provided with a value assignment (e.g. "--file=test.txt" forCliLongOption"--file"),falseotherwise (e.g. "--file test.txt").
-
isOption
public boolean isOption()
- Specified by:
isOptionin classCliArgument- Returns:
trueif thisCliArgumentis aCliOption(e.g. "-h" or "--help"),falseotherwise (if it is aCliValue).
-
isValue
public boolean isValue()
- Specified by:
isValuein classCliArgument- Returns:
trueif thisCliArgumentis aCliValue,falseotherwise (if it is aCliOption).
-
isEndOptions
public boolean isEndOptions()
- Specified by:
isEndOptionsin classCliArgument- Returns:
trueifCliArgument.END_OPTIONSwas detected,falseotherwise. IfCliArgument.END_OPTIONSis parsed for the first time, it will be skipped, all following arguments will be parsed asCliValueno matter if they start with hyphen ('-') or not and will returntruefor this method.
-
-