improve argument/option declaration

This commit is contained in:
2026-01-06 11:12:45 +01:00
parent 86409e9f72
commit 0a8e51c7ab
11 changed files with 55 additions and 75 deletions

View File

@@ -3,9 +3,6 @@ package com.infendro.cli.parser
import com.infendro.cli.exception.run.ParseException
object FloatParser : Parser<Float> {
override fun parse(text: String): Float = try {
text.toFloat()
} catch (_: Exception) {
throw ParseException(text, "Float")
}
override fun parse(text: String): Float = text.toFloatOrNull()
?: throw ParseException(text, "Float")
}