clikt / com.github.ajalt.clikt.parameters.options / default

default

fun <T : Any> FlagOption<T?>.default(value: T): FlagOption<T>

Set a default value for a option.

fun <EachT : Any, ValueT> NullableOption<EachT, ValueT>.default(value: EachT): OptionWithValues<EachT, EachT, ValueT>

If the option is not called on the command line (and is not set in an envvar), use value for the option.

This must be applied after all other transforms.

Example:

val opt: Pair<Int, Int> by option().int().pair().default(1 to 2)