I'm looking for a Nim version of D's escapeShellFileName (https://github.com/dlang/phobos/blob/v2.080.1/std/process.d#L3171)
execCmd only accepts a string input, so if I have an array instead, with escapeShellFileName I'd be able to use:
# for example
let arg = @["ls", "abc def"]
execCmd(arg.mapIt(it.escapeShellFileName).join(" ")
That's just an example, there are other use cases of escapeShellFileName.
NOTE: escapeShellFileName needs to be robust to containing internal quotes (as handled in D implementation)
thanks! exactly what I was looking for, I was looking in wrong module (osproc)
maybe we could add this as suggested above (and adapted to use quoteShell)?
proc escapeShellCommand*(a:seq[string]):auto=
return a.mapIt(it.quoteShell).join(" ")