summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-08-30 23:50:09 +0200
committerGitHub <noreply@github.com>2018-08-30 23:50:09 +0200
commit36473acf473616e1817367dda59439a32f51b07f (patch)
tree2a3b47fe37cf6ffd6aee0d21312ba1488a0c7bc0 /lib
parentdf4d5b77a14b3b84f3ff37b3741dd039c9e21ce4 (diff)
downloadNim-36473acf473616e1817367dda59439a32f51b07f.tar.gz
fixes a parseopt regression (#8820)
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/parseopt.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pure/parseopt.nim b/lib/pure/parseopt.nim
index 70319ddf0..c91134738 100644
--- a/lib/pure/parseopt.nim
+++ b/lib/pure/parseopt.nim
@@ -207,9 +207,12 @@ proc next*(p: var OptParser) {.rtl, extern: "npo$1".} =
       i = parseWord(p.cmds[p.idx], i, p.key.string, {' ', '\t', ':', '='})
       while i < p.cmds[p.idx].len and p.cmds[p.idx][i] in {'\t', ' '}: inc(i)
       if i < p.cmds[p.idx].len and p.cmds[p.idx][i] in {':', '='}:
-        if i < p.cmds[p.idx].len and p.cmds[p.idx][i] in {':', '='}:
-          inc(i)
+        inc(i)
         while i < p.cmds[p.idx].len and p.cmds[p.idx][i] in {'\t', ' '}: inc(i)
+        # if we're at the end, use the next command line option:
+        if i >= p.cmds[p.idx].len and p.idx < p.cmds.len:
+          inc p.idx
+          i = 0
         p.val = TaintedString p.cmds[p.idx].substr(i)
       elif len(p.longNoVal) > 0 and p.key.string notin p.longNoVal and p.idx+1 < p.cmds.len:
         p.val = TaintedString p.cmds[p.idx+1]