parent
9e37e3e5e8
commit
8f4c5a8955
7 changed files with 62 additions and 31 deletions
|
|
@ -1,3 +1,6 @@
|
|||
discard """
|
||||
"""
|
||||
|
||||
import os
|
||||
import osproc
|
||||
import parseopt2
|
||||
|
|
@ -7,12 +10,12 @@ let argv = commandLineParams()
|
|||
|
||||
if argv == @[]:
|
||||
# this won't work with spaces
|
||||
assert execShellCmd(getAppFilename() & " \"foo bar\" --aa:bar=a --a=c:d --ab -c --a[baz]:doo") == 0
|
||||
doAssert execShellCmd(getAppFilename() & " \"foo bar\" --aa:bar=a --a=c:d --ab -c --a[baz]:doo") == 0
|
||||
else:
|
||||
let f = toSeq(getopt())
|
||||
echo f.repr
|
||||
assert f[0].kind == cmdArgument and f[0].key == "foo bar" and f[0].val == ""
|
||||
assert f[1].kind == cmdLongOption and f[1].key == "aa" and f[1].val == "bar=a"
|
||||
assert f[2].kind == cmdLongOption and f[2].key == "a=c" and f[2].val == "d"
|
||||
assert f[3].kind == cmdLongOption and f[3].key == "ab" and f[3].val == ""
|
||||
assert f[4].kind == cmdShortOption and f[4].key == "c" and f[4].val == ""
|
||||
doAssert f[0].kind == cmdArgument and f[0].key == "foo bar" and f[0].val == ""
|
||||
doAssert f[1].kind == cmdLongOption and f[1].key == "aa" and f[1].val == "bar=a"
|
||||
doAssert f[2].kind == cmdLongOption and f[2].key == "a=c" and f[2].val == "d"
|
||||
doAssert f[3].kind == cmdLongOption and f[3].key == "ab" and f[3].val == ""
|
||||
doAssert f[4].kind == cmdShortOption and f[4].key == "c" and f[4].val == ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue