clikt / com.github.ajalt.clikt.parameters.groups / mutuallyExclusiveOptions


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

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.


``` kotlin val fruits: Int? by mutuallyExclusiveOptions( option(“–apples”).int(), option(“–oranges”).int() )

See Also