1.4.0 release #9
@@ -31,7 +31,7 @@ internal class ContextParser(
|
||||
private val current: String
|
||||
get() = args[index]
|
||||
private val next: String?
|
||||
get() = args.getOrNull(index)
|
||||
get() = args.getOrNull(index + 1)
|
||||
|
||||
private fun hasNext() = index < args.size
|
||||
private fun consume() {
|
||||
@@ -121,7 +121,7 @@ internal class ContextParser(
|
||||
else -> {
|
||||
if (next?.startsWith('-') == false) {
|
||||
consume()
|
||||
trimmed to next
|
||||
trimmed to current
|
||||
} else {
|
||||
trimmed to null
|
||||
}
|
||||
@@ -139,7 +139,7 @@ internal class ContextParser(
|
||||
|
||||
val value = when {
|
||||
text != null ->
|
||||
when (val result = option.parser.parse(current)) {
|
||||
when (val result = option.parser.parse(text)) {
|
||||
is Parser.Result.Success<*> -> result.value
|
||||
is Parser.Result.Failure<*> -> return failure(path, result.failure)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user