enum

inline fun <T : Enum<T>> RawArgument.enum(ignoreCase: Boolean = true, key: (T) -> String = { it.name }): ProcessedArgument<T, T>

Convert the argument to the values of an enum.

If ignoreCase is false, the argument will only accept values that match the case of the enum values.

Example:

enum class Size { SMALL, LARGE }
argument().enum<Size>()

Parameters

key

A block that returns the command line value to use for an enum value. The default is the enum name.

inline fun <T : Enum<T>> RawOption.enum(ignoreCase: Boolean = true, key: (T) -> String = { it.name }): NullableOption<T, T>

Convert the option to the values of an enum.

If ignoreCase is false, the option will only accept values that match the case of the enum values.

Example:

enum class Size { SMALL, LARGE }
option().enum<Size>()

Parameters

key

A block that returns the command line value to use for an enum value. The default is the enum name.