fun <T : Any> ParameterHolder.mutuallyExclusiveOptions(option1: OptionDelegate<out T?>, option2: OptionDelegate<out T?>, vararg options: OptionDelegate<out T?>, name: String? = null, help: String? = null): MutuallyExclusiveOptions<T, T?>

Declare a set of two or more mutually exclusive options.

If none of the options are given on the command line, the value of this delegate will be null. If one option is given, the value will be that option's value. If more than one option is given, the value of the last one is used.

All options in the group must have a name specified. All options must be nullable (they cannot use flag, required etc.). If you want flags, you should use switch instead.


val fruits: Int? by mutuallyExclusiveOptions(

See also



If given, the options in this group will be grouped together under this value in the help output


If given, this text will be added in help output to the group. If name is null, this value is not used.