Skip to content

Home

clikt / com.github.ajalt.clikt.parameters.arguments

Package com.github.ajalt.clikt.parameters.arguments

Types

Name Summary
Argument interface Argument
A positional parameter to a command.
ArgumentDelegate interface ArgumentDelegate<out T> :Argument,ReadOnlyProperty<CliktCommand,T>
An argument that functions as a property delegate
ArgumentTransformContext class ArgumentTransformContext :Argument
A receiver for argument transformers.
ProcessedArgument class ProcessedArgument<AllT, ValueT> :ArgumentDelegate<AllT>
An Argument delegate implementation that transforms its values .

Type Aliases

Name Summary
ArgCallsTransformer typealias ArgCallsTransformer<AllT, EachT> =ArgumentTransformContext.(List<EachT>) ->AllT
A callback that transforms all the values into the final argument type
ArgValidator typealias ArgValidator<AllT> =ArgumentTransformContext.(AllT) ->Unit
A callback validates the final argument type
ArgValueTransformer typealias ArgValueTransformer<T> =ArgumentTransformContext.(String) ->T
A callback that transforms a single value from a string to the value type

Functions

Name Summary
argument funCliktCommand.argument(name:String= "", help:String= "", helpTags:Map<String,String> = emptyMap()): RawArgument
Create a property delegate argument.
convert fun <T :Any> RawArgument.convert(completionCandidates:CompletionCandidates= this.completionCandidates, conversion:ArgValueTransformer<T>):ProcessedArgument<T,T>
Convert the argument’s values.
default fun <T :Any>ProcessedArgument<T,T>.default(value:T):ArgumentDelegate<T>
If the argument is not given, use value, com.github.ajalt.clikt.parameters.arguments.default.T)/value) instead of throwing an error.
defaultLazy fun <T :Any>ProcessedArgument<T,T>.defaultLazy(value: () ->T):ArgumentDelegate<T>
If the argument is not given, call value, kotlin.Function0((com.github.ajalt.clikt.parameters.arguments.defaultLazy.T)))/value) and use its return value instead of throwing an error.
multiple fun <T :Any>ProcessedArgument<T,T>.multiple(required:Boolean= false):ProcessedArgument<List<T>,T>
Accept any number of values to this argument.
optional fun <AllT :Any, ValueT>ProcessedArgument<AllT,ValueT>.optional():ProcessedArgument<AllT?,ValueT>
Return null instead of throwing an error if no value is given.
pair 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.
transformAll 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.
triple 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
unique fun <T :Any>ProcessedArgument<List<T>,T>.unique():ProcessedArgument<Set<T>,T>
Only store unique values for this argument
validate 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.