clikt / com.github.ajalt.clikt.parameters.types / enum

enum

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

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()

Parameters

key - A block that returns the command line value to use for an enum value. The default is the enum name.inline fun <reified 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()

Parameters

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