OptionGroup
open class OptionGroup(name: String? = null, help: String? = null) : 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.
Example:
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()
}
Content copied to clipboard
Functions
Link copied to clipboard
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.
Link copied to clipboard
fun ParameterHolder.option(vararg names: String, help: String = "", metavar: String? = null, hidden: Boolean = false, envvar: String? = null, helpTags: Map<String, String> = emptyMap(), completionCandidates: CompletionCandidates? = null, valueSourceKey: String? = null, eager: Boolean = false): RawOption
Create a property delegate option.
Link copied to clipboard
Link copied to clipboard
Called after all of a command's parameters have been finalized to perform validation of the final values.
Link copied to clipboard
Register an option with this command or group.