Escape and join command-line arguments, cross-platform.
npm install command-jointypescript
import { commandJoin } from "command-join"
`
$3
Escapes each command-line argument and joins them into a string that can then be executed, e.g. via child_process.exec.
If a string is passed, an array containing the string will instead be processed.
Example
`javascript
const command = commandJoin(['a', "b\\", "'c"])
command
// output on Windows: a "b\\" 'c
// output on Linux: a 'b\' \'c
`
See the tests for more convoluted examples.
Migrating
Migrating to v3:
`diff
- const commandJoin = require("command-join")
+ const { commandJoin } = require("command-join")
``