summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2019-01-15 12:51:02 -0800
committerAndreas Rumpf <rumpf_a@web.de>2019-01-15 21:51:02 +0100
commit795e5e11ef53260a0a15e25eba36dddbd83900c1 (patch)
tree274d7791a298fe9f93a43766c187382075caf479 /lib/pure
parentbeed27b75d27118324d89b83974b7cf3065769cf (diff)
downloadNim-795e5e11ef53260a0a15e25eba36dddbd83900c1.tar.gz
parseopt2.cmdLineRest is now correct too (#10304)
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/parseopt2.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pure/parseopt2.nim b/lib/pure/parseopt2.nim
index 51a70b6d1..a84943cf9 100644
--- a/lib/pure/parseopt2.nim
+++ b/lib/pure/parseopt2.nim
@@ -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]