choice

fun <T : Any> RawArgument.choice(choices: Map<String, T>, ignoreCase: Boolean = false): ProcessedArgument<T, T>

Convert the argument based on a fixed set of values.

If ignoreCase is true, the argument will accept values is any mix of upper and lower case.

Example:

argument().choice(mapOf("foo" to 1, "bar" to 2))
fun <T : Any> RawArgument.choice(vararg choices: Pair<String, T>, ignoreCase: Boolean = false): ProcessedArgument<T, T>

Convert the argument based on a fixed set of values.

If ignoreCase is true, the argument will accept values is any mix of upper and lower case.

Example:

argument().choice("foo" to 1, "bar" to 2)
fun RawArgument.choice(vararg choices: String, ignoreCase: Boolean = false): ProcessedArgument<String, String>

Restrict the argument to a fixed set of values.

If ignoreCase is true, the argument will accept values is any mix of upper and lower case. The argument's final value will always match the case of the corresponding value in choices.

Example:

argument().choice("foo", "bar")
fun <T : Any> RawOption.choice(choices: Map<String, T>, metavar: String = mvar(choices.keys), ignoreCase: Boolean = false): NullableOption<T, T>

Convert the option based on a fixed set of values.

If ignoreCase is true, the option will accept values is any mix of upper and lower case.

Example:

option().choice(mapOf("foo" to 1, "bar" to 2))

See also

fun <T : Any> RawOption.choice(vararg choices: Pair<String, T>, metavar: String = mvar(choices.map { it.first }), ignoreCase: Boolean = false): NullableOption<T, T>

Convert the option based on a fixed set of values.

If ignoreCase is true, the option will accept values is any mix of upper and lower case.

Example:

option().choice("foo" to 1, "bar" to 2)

See also

fun RawOption.choice(vararg choices: String, metavar: String = mvar(choices.asIterable()), ignoreCase: Boolean = false): NullableOption<String, String>

Restrict the option to a fixed set of values.

If ignoreCase is true, the option will accept values is any mix of upper and lower case. The option's final value will always match the case of the corresponding value in choices.

Example:

option().choice("foo", "bar")