parseopt2.cmdLineRest is now correct too (#10304)

This commit is contained in:
Timothee Cour 2019-01-15 12:51:02 -08:00 • committed by Andreas Rumpf
commit 795e5e11ef
2 changed files with 23 additions and 20 deletions

View file

@ -112,10 +112,10 @@ proc next(p: var OptParser) =
p.key = token
p.val = ""
proc cmdLineRest*(p: OptParser): TaintedString {.rtl, extern: "npo2$1", deprecated.} =
## Returns part of command line string that has not been parsed yet.
## Do not use - does not correctly handle whitespace.
return p.cmd[p.pos..p.cmd.len-1].join(" ")
proc cmdLineRest*(p: OptParser): TaintedString {.rtl, extern: "npo2$1".} =
## Returns the part of command line string that has not been parsed yet,
## properly quoted.
return p.cmd[p.pos..p.cmd.len-1].quoteShellCommand
type
GetoptResult* = tuple[kind: CmdLineKind, key, val: TaintedString]