Skip to content

ArgumentBuilder<T>

extendsPropertyDelegateProvider<Arguments, ReadOnlyProperty<Arguments, T>>

Builds a positional argument, named after the property it is assigned to. The call you end with decides the property's type:

  • end here and the argument is required and non-null;

  • optional makes it nullable, resolving to null when absent;

  • multiple captures all remaining positionals into a List<T>.

Refine the value type (.int(), .enum<E>(), .convert(...)) before choosing cardinality.

ArgumentBuilders.kt

Functions

convert

fun <R> convert(converter: Converter<R>): ArgumentBuilder<R>
ArgumentBuilders.kt

double

fun double(): ArgumentBuilder<Double>
ArgumentBuilders.kt

enum

inline fun <E> enum(): ArgumentBuilder<E>

Parses the value as the enum E, matching constant names case-insensitively.

ArgumentBuilders.kt

multiple

fun multiple(): ArgumentListBuilder<T>

Captures all remaining positionals into a List<T>. Must be the last argument declared.

ArgumentBuilders.kt

optional

fun optional(): OptionalArgumentBuilder<T>

Makes the argument optional; it resolves to null when absent.

ArgumentBuilders.kt

provideDelegate

open operator override fun provideDelegate(thisRef: Arguments, property: KProperty<*>): ReadOnlyProperty<Arguments, T>
ArgumentBuilders.kt

Released under the Apache License 2.0.