This commit is contained in:
Zahary Karadjov 2019-11-08 16:28:04 +00:00
parent 31c9f9ae38
commit 6f5f030539
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
2 changed files with 9 additions and 1 deletions

View File

@ -114,7 +114,8 @@ proc next*(p: var OptParser) =
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 and p.allowWhitespaceAfterColon:
if p.allowWhitespaceAfterColon and i >= p.cmds[p.idx].len and
p.idx + 1 < p.cmds.len and p.cmds[p.idx + 1][0] != '-':
inc p.idx
i = 0
if p.idx < p.cmds.len:

7
tests/issue_6.nim Normal file
View File

@ -0,0 +1,7 @@
import confutils
# TODO add test cases for https://github.com/status-im/nim-confutils/issues/6
cli do (arg1: string = "", arg2: string = ""):
echo "arg1: ", arg1
echo "arg2: ", arg2