- 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 boolean
isAssignment()
boolean
isEndOptions()
boolean
isOption()
boolean
isValue()
-
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
- - theassignment
flag.
-
-
Method Detail
-
isAssignment
public boolean isAssignment()
- Returns:
true
if this option was provided with a value assignment (e.g. "--file=test.txt" forCliLongOption
"--file"),false
otherwise (e.g. "--file test.txt").
-
isOption
public boolean isOption()
- Specified by:
isOption
in classCliArgument
- Returns:
true
if thisCliArgument
is aCliOption
(e.g. "-h" or "--help"),false
otherwise (if it is aCliValue
).
-
isValue
public boolean isValue()
- Specified by:
isValue
in classCliArgument
- Returns:
true
if thisCliArgument
is aCliValue
,false
otherwise (if it is aCliOption
).
-
isEndOptions
public boolean isEndOptions()
- Specified by:
isEndOptions
in classCliArgument
- Returns:
true
ifCliArgument.END_OPTIONS
was detected,false
otherwise. IfCliArgument.END_OPTIONS
is parsed for the first time, it will be skipped, all following arguments will be parsed asCliValue
no matter if they start with hyphen ('-') or not and will returntrue
for this method.
-
-