added parseopt.remainingArgs; refs #9951

This commit is contained in:
Araq
2018-12-14 11:41:19 +01:00
parent f551b72fba
commit 3ba8f158fb
2 changed files with 6 additions and 0 deletions

View File

@@ -91,6 +91,7 @@ proc enumToString*(enums: openArray[enum]): string =
of two texts by line.
- Added `os.relativePath`.
- Added `parseopt.remainingArgs`.
### Library changes

View File

@@ -234,6 +234,11 @@ when declared(os.paramCount):
res.add quote(p.cmds[i])
result = res.TaintedString
proc remainingArgs*(p: OptParser): seq[TaintedString] {.rtl, extern: "npo$1".} =
## retrieves the rest of the command line that has not been parsed yet.
result = @[]
for i in p.idx..<p.cmds.len: result.add p.cmds[i]
iterator getopt*(p: var OptParser): tuple[kind: CmdLineKind, key, val: TaintedString] =
## This is an convenience iterator for iterating over the given OptParser object.
## Example: