Class CliOption

java.lang.Object
io.github.mmm.cli.CliArgument
io.github.mmm.cli.CliOption
Direct Known Subclasses:
CliLongOption, CliShortOption

public abstract class CliOption extends CliArgument
CliArgument for an option. It is either a CliShortOption or a CliLongOption.
  • Constructor Details

    • CliOption

      public CliOption(String arg, boolean assignment)
      The constructor.
      Parameters:
      arg - the argument option.
      assignment - - the assignment flag.
  • Method Details

    • isAssignment

      public boolean isAssignment()
      Returns:
      true if this option was provided with a value assignment (e.g. "--file=test.txt" for CliLongOption "--file"), false otherwise (e.g. "--file test.txt").
    • isOption

      public boolean isOption()
      Specified by:
      isOption in class CliArgument
      Returns:
      true if this CliArgument is a CliOption (e.g. "-h" or "--help"), false otherwise (if it is a CliValue).
    • isValue

      public boolean isValue()
      Specified by:
      isValue in class CliArgument
      Returns:
      true if this CliArgument is a CliValue, false otherwise (if it is a CliOption).
    • isEndOptions

      public boolean isEndOptions()
      Specified by:
      isEndOptions in class CliArgument
      Returns:
      true if CliArgument.END_OPTIONS was detected, false otherwise. If CliArgument.END_OPTIONS is parsed for the first time, it will be skipped, all following arguments will be parsed as CliValue no matter if they start with hyphen ('-') or not and will return true for this method.