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


open class OptionGroup : ParameterGroup, ParameterHolder

A group of options that can be shown together in help output, or restricted to be cooccurring.

Declare a subclass with option delegate properties, then use an instance of your subclass is a delegate property in your command with provideDelegate.


``` kotlin class UserOptions : OptionGroup(name = “User Options”, help = “Options controlling the user”) { val name by option() val age by option().int() }

class Tool : CliktCommand() { val userOptions by UserOptions() }


Name Summary
<init> A group of options that can be shown together in help output, or restricted to be cooccurring.OptionGroup(name:String? = null, help:String? = null)


Name Summary
groupHelp A help message to display for this val groupHelp:String?
groupName The name of the group, or null if parameters in the group should not be separated from other parameters in the help val groupName:String?


Name Summary
finalize Called after this command’s argv is parsed and all options are validated to validate the group fun finalize(context:Context, invocationsByOption:Map<Option,List<Invocation>>):Unit
postValidate Called after all of a command’s parameters have been finalized to perform validation of the final fun postValidate(context:Context):Unit
registerOption Register an option with this command or fun registerOption(option:GroupableOption):Unit

Extension Functions

Name Summary
cooccurring Make this group a co-occurring <T :OptionGroup> T.cooccurring():CoOccurringOptionGroup<T, T?>
mutuallyExclusiveOptions Declare a set of two or more mutually exclusive <T :Any>ParameterHolder.mutuallyExclusiveOptions(option1:OptionDelegate<T?>, option2:OptionDelegate<T?>, vararg options:OptionDelegate<T?>, name:String? = null, help:String? = null):MutuallyExclusiveOptions<T, T?>
option Create a property delegate option.funParameterHolder.option(vararg names:String, help:String= "", metavar:String? = null, hidden:Boolean= false, envvar:String? = null, envvarSplit:Regex? = null, helpTags:Map<String,String> = emptyMap(), completionCandidates:CompletionCandidates? = null):RawOption
provideDelegate operator fun <T :OptionGroup> T.provideDelegate(thisRef:CliktCommand, prop:KProperty<*>):ReadOnlyProperty<CliktCommand, T>