java.lang.Object
net.forthecrown.grenadier.types.options.Options

public final class Options extends Object
Static factory class for FlagOption and ArgumentOption instances and builders.
See Also:
  • Method Details

    • flag

      public static FlagOption.Builder flag()
      Creates a new flag builder
      Returns:
      Created flag builder
    • flag

      public static FlagOption flag(String label)
      Creates a flag option with a single label
      Parameters:
      label - Flag label
      Returns:
      Created flag option
    • argument

      public static <T> ArgumentOption.Builder<T> argument(ArgumentType<T> type)
      Creates a new argument option builder
      Type Parameters:
      T - Option value's type
      Parameters:
      type - Option type
      Returns:
      Created builder
    • argument

      public static <T> ArgumentOption<T> argument(ArgumentType<T> type, String label)
      Creates an argument option with a single label
      Type Parameters:
      T - Option value's type
      Parameters:
      type - Option type
      label - Option label
      Returns:
      Created option
    • validateLabel

      public static void validateLabel(String label) throws IllegalArgumentException
      Tests if a specified label is a valid label for an option.

      Labels have to match the Readers.WORD_PATTERN to be considered valid labels.

      Parameters:
      label - Label to test
      Throws:
      IllegalArgumentException - If the label was invalid