All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.github.ajalt.clikt.parameters.options.ValueWithDefault.kt Maven / Gradle / Ivy

package com.github.ajalt.clikt.parameters.options

/** A container for a value that can have a default value and can be manually set */
data class ValueWithDefault(val explicit: T?, val default: T) {
    val value: T get() = explicit ?: default
}

/** Create a copy with a new [default] value */
fun  ValueWithDefault.withDefault(default: T) = copy(default = default)

/** Create a copy with a new [explicit] value */
fun  ValueWithDefault.withExplicit(explicit: T) = copy(explicit = explicit)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy