interface Argument
A positional parameter to a command. |
|
interface ArgumentDelegate<out T> : Argument, ReadOnlyProperty<CliktCommand, T>
An argument that functions as a property delegate |
|
class ArgumentTransformContext : Argument
A receiver for argument transformers. |
|
class ProcessedArgument<AllT, ValueT> : ArgumentDelegate<AllT>
An Argument delegate implementation that transforms its values . |
typealias ArgCallsTransformer<AllT, EachT> = ArgumentTransformContext.(List<EachT>) -> AllT
A callback that transforms all the values into the final argument type |
|
typealias ArgValidator<AllT> = ArgumentTransformContext.(AllT) -> Unit
A callback validates the final argument type |
|
typealias ArgValueTransformer<T> = ArgumentTransformContext.(String) -> T
A callback that transforms a single value from a string to the value type |
fun CliktCommand.argument(name: String = "", help: String = ""): RawArgument
Create a property delegate argument. |
|
fun <T : Any> RawArgument.convert(conversion: ArgValueTransformer<T>): ProcessedArgument<T, T>
Convert the argument's values. |
|
fun <T : Any> ProcessedArgument<T, T>.default(value: T): ArgumentDelegate<T>
If the argument is not given, use value instead of throwing an error. |
|
fun <T : Any> ProcessedArgument<T, T>.multiple(required: Boolean = false): ProcessedArgument<List<T>, T>
Accept any number of values to this argument. |
|
fun <AllT : Any, ValueT> ProcessedArgument<AllT, ValueT>.optional(): ProcessedArgument<AllT?, ValueT>
Return null instead of throwing an error if no value is given. |
|
fun <T : Any> ProcessedArgument<T, T>.pair(): ProcessedArgument<Pair<T, T>, T>
Require exactly two values to this argument, and store them in a Pair. |
|
fun <AllInT, ValueT, AllOutT> ProcessedArgument<AllInT, ValueT>.transformAll(nvalues: Int? = null, required: Boolean? = null, transform: ArgCallsTransformer<AllOutT, ValueT>): ProcessedArgument<AllOutT, ValueT>
Transform all values to the final argument type. |
|
fun <T : Any> ProcessedArgument<T, T>.triple(): ProcessedArgument<Triple<T, T, T>, T>
Require exactly three values to this argument, and store them in a Triple |
|
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. |