Package-level declarations

Types

Link copied to clipboard

A callback that transforms all the values into the final argument type

Link copied to clipboard
interface Argument

A positional parameter to a command.

Link copied to clipboard

An argument that functions as a property delegate

Link copied to clipboard
class ArgumentTransformContext(val argument: Argument, val context: Context) : Argument, TransformContext

A receiver for argument transformers.

Link copied to clipboard

A callback validates the final argument type

Link copied to clipboard

A callback that transforms a single value from one type to another

Link copied to clipboard

A callback that transforms a single value from a string to the value type

Link copied to clipboard

An Argument delegate implementation that transforms its values .

Link copied to clipboard

Functions

Link copied to clipboard
fun CliktCommand.argument(name: String = "", help: String = "", helpTags: Map<String, String> = emptyMap(), completionCandidates: CompletionCandidates? = null): RawArgument

Create a property delegate argument.

Link copied to clipboard
inline fun <AllT, ValueT> ProcessedArgument<AllT, ValueT>.check(crossinline lazyMessage: (AllT & Any) -> String = { it.toString() }, crossinline validator: (AllT & Any) -> Boolean): ArgumentDelegate<AllT>
inline fun <AllT, ValueT> ProcessedArgument<AllT, ValueT>.check(message: String, crossinline validator: (AllT & Any) -> Boolean): ArgumentDelegate<AllT>

Check the final argument value and raise an error if it's not valid.

Link copied to clipboard
inline fun <InT : Any, ValueT : Any> ProcessedArgument<InT, InT>.convert(completionCandidates: CompletionCandidates? = explicitCompletionCandidates, crossinline conversion: ArgValueConverter<InT, ValueT>): ProcessedArgument<ValueT, ValueT>

Convert the argument's values.

Link copied to clipboard
fun <T : Any> ProcessedArgument<T, T>.default(value: T, defaultForHelp: String = value.toString()): ArgumentDelegate<T>

If the argument is not given, use value instead of throwing an error.

Link copied to clipboard
inline fun <T : Any> ProcessedArgument<T, T>.defaultLazy(defaultForHelp: String = "", crossinline value: () -> T): ArgumentDelegate<T>

If the argument is not given, call value and use its return value instead of throwing an error.

Link copied to clipboard

Set the help for this argument lazily.

Set the help for this argument.

Link copied to clipboard
fun <T : Any> ProcessedArgument<T, T>.multiple(required: Boolean = false, default: List<T> = emptyList()): ProcessedArgument<List<T>, T>

Accept any number of values to this argument.

Link copied to clipboard

Return null instead of throwing an error if no value is given.

Link copied to clipboard

Require exactly two values to this argument, and store them in a Pair.

Link copied to clipboard
fun <AllInT, ValueT, AllOutT> ProcessedArgument<AllInT, ValueT>.transformAll(nvalues: Int? = null, required: Boolean? = null, defaultForHelp: String? = null, transform: ArgCallsTransformer<AllOutT, ValueT>): ProcessedArgument<AllOutT, ValueT>

Transform all values to the final argument type.

Link copied to clipboard

Require exactly three values to this argument, and store them in a Triple

Link copied to clipboard

Only store unique values for this argument

Link copied to clipboard

Check the final argument value and raise an error if it's not valid.