defaultByName

fun <T : OptionGroup> ChoiceGroup<T, T?>.defaultByName(name: String): ChoiceGroup<T, T>

If a groupChoice or groupSwitch option is not called on the command line, use the value of the group with a switch or choice name.

Example:

option().groupChoice("foo" to FooOptionGroup(), "bar" to BarOptionGroup()).defaultByName("foo")
option().groupSwitch("--foo" to FooOptionGroup(), "--bar" to BarOptionGroup()).defaultByName("--bar")

Throws

IllegalArgumentException

if name is not one of the option's choice/switch names.