Sometimes I check that a counted flag isn't too high and I either clamp it or I produce an error. It's not too hard to do myself, of course, but I figured I'd propose it for inclusion in counted directly.
Maybe
counted(limit: Int = Int.MAX_VALUE, error: Boolean = false)
This would allow
val verbosity by option("-v").counted(limit = 3)
or
val rotations by options("-r").counted(limit = 2, error = true)
but also allows this somewhat useless form
val inputCount by options("-i").counted(error = true) // never errors
Like I said, I don't need this, but I've written counted validation at least three times now so I figured it was worth proposing for inclusion.
Sometimes I check that a
counted
flag isn't too high and I either clamp it or I produce an error. It's not too hard to do myself, of course, but I figured I'd propose it for inclusion incounted
directly.Maybe
This would allow
or
but also allows this somewhat useless form
Like I said, I don't need this, but I've written
counted
validation at least three times now so I figured it was worth proposing for inclusion.