validate

fun validate(message: String = "Invalid count for @name: @value", predicate: (Int) -> Boolean): CountBuilder(source)

Adds a validator that checks the count value against the given predicate.

Parameters

message

Template message for validation errors. Supports:

  • @name: property name

  • @value: the invalid count value

  • @switches: option switches (e.g. "-v|--verbose")

predicate

Function that returns true if the count is valid


fun validate(vararg validations: Pair<String, (Int) -> Boolean>): CountBuilder(source)

Adds multiple validators at once.

Parameters

validations

Pairs of (message template, predicate) for validation