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

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 : Any, ValueT> ProcessedArgument<AllT, ValueT>.check(crossinline lazyMessage: (AllT) -> String = { it.toString() }, crossinline validator: (AllT) -> Boolean): ArgumentDelegate<AllT>
inline fun <AllT : Any, ValueT> ProcessedArgument<AllT, ValueT>.check(message: String, crossinline validator: (AllT) -> Boolean): ArgumentDelegate<AllT>
@JvmName(name = "nullableLazyCheck")
inline fun <AllT : Any, ValueT> ProcessedArgument<AllT?, ValueT>.check(crossinline lazyMessage: (AllT) -> String = { it.toString() }, crossinline validator: (AllT) -> Boolean): ArgumentDelegate<AllT?>
@JvmName(name = "nullableCheck")
inline fun <AllT : Any, ValueT> ProcessedArgument<AllT?, ValueT>.check(message: String, crossinline validator: (AllT) -> 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 = completionCandidatesWithDefault.default, 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(crossinline value: () -> T): ArgumentDelegate<T>

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.

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

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
@JvmName(name = "nullableValidate")
fun <AllT : Any, ValueT> ProcessedArgument<AllT?, ValueT>.validate(validator: ArgValidator<AllT>): ArgumentDelegate<AllT?>

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