Converter
Converts a raw command-line string into a typed value. Implement this to support a type beyond the built-ins.
object SlugConverter : Converter<String> {
override val typeName: String = "slug"
override fun convert(raw: String): String {
require(raw.all { it.isLetterOrDigit() || it == '-' }) { "not a slug: '$raw'" }
return raw.lowercase()
}
}Content copied to clipboard
Type Parameters
T
the produced value type.