switch

fun <T : Any> RawOption.switch(choices: Map<String, T>): FlagOption<T?>

Turn an option into a set of flags that each map to a value.

Example:

option().switch(mapOf("--foo" to Foo(), "--bar" to Bar()))
fun <T : Any> RawOption.switch(vararg choices: Pair<String, T>): FlagOption<T?>

Turn an option into a set of flags that each map to a value.

Example:

option().switch("--foo" to Foo(), "--bar" to Bar())