improve argument/option declaration
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user