-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' of github.com:nim-lang/Nim into devel
- Loading branch information
Showing
15 changed files
with
172 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
discard """ | ||
file: "tparseopt.nim" | ||
output: ''' | ||
parseopt | ||
first round | ||
kind: cmdLongOption key:val -- left: | ||
second round | ||
kind: cmdLongOption key:val -- left: | ||
kind: cmdLongOption key:val -- debug:3 | ||
kind: cmdShortOption key:val -- l:4 | ||
kind: cmdShortOption key:val -- r:2 | ||
parseopt2 | ||
first round | ||
kind: cmdLongOption key:val -- left: | ||
second round | ||
kind: cmdLongOption key:val -- left: | ||
kind: cmdLongOption key:val -- debug:3 | ||
kind: cmdShortOption key:val -- l:4 | ||
kind: cmdShortOption key:val -- r:2''' | ||
""" | ||
from parseopt import nil | ||
from parseopt2 import nil | ||
|
||
|
||
block: | ||
echo "parseopt" | ||
for kind, key, val in parseopt.getopt(): | ||
echo "kind: ", kind, "\tkey:val -- ", key, ":", val | ||
|
||
# pass custom cmdline arguments | ||
echo "first round" | ||
var argv = "--left --debug:3 -l=4 -r:2" | ||
var p = parseopt.initOptParser(argv) | ||
for kind, key, val in parseopt.getopt(p): | ||
echo "kind: ", kind, "\tkey:val -- ", key, ":", val | ||
break | ||
# reset getopt iterator and check arguments are returned correctly. | ||
echo "second round" | ||
for kind, key, val in parseopt.getopt(p): | ||
echo "kind: ", kind, "\tkey:val -- ", key, ":", val | ||
|
||
block: | ||
echo "parseopt2" | ||
for kind, key, val in parseopt2.getopt(): | ||
echo "kind: ", kind, "\tkey:val -- ", key, ":", val | ||
|
||
# pass custom cmdline arguments | ||
echo "first round" | ||
var argv: seq[string] = @["--left", "--debug:3", "-l=4", "-r:2"] | ||
var p = parseopt2.initOptParser(argv) | ||
for kind, key, val in parseopt2.getopt(p): | ||
echo "kind: ", kind, "\tkey:val -- ", key, ":", val | ||
break | ||
# reset getopt iterator and check arguments are returned correctly. | ||
echo "second round" | ||
for kind, key, val in parseopt2.getopt(p): | ||
echo "kind: ", kind, "\tkey:val -- ", key, ":", val |