JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 198115
  • Score
    100M100P100Q170341F
  • License MIT

Turn a string of command line options into an array for child_process.spawn

Package Exports

  • spawn-args

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spawn-args) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

spawn-args

Build status

Turn a string of command line options into an array for child_process.spawn

install

$ npm install spawn-args

usage

var spawnargs = require('spawn-args');
//spawnargs(argString:string[, options:object]);

var args = spawnargs('-port 80 --title "this is a title"');

/*

    [
        '-port',
        '80',
        '--title',
        '"this is a title"'
    ]
    
*/

The removequotes option will remove quotes from values if they do not have spaces

var args2 = spawnargs('-port 80 --color "red" --title "this is a title"', { removequotes: true });

/*

    [
        '-port',
        '80',
        '--title',
        '"this is a title"'
    ]
    
*/

If removequotes is always then quotes will be removed even if the value contains spaces

var args3 = spawnargs('-port 80 --color "red" --title "this is a title"', { removequotes: 'always' });

/*

    [
        '-port',
        '80',
        '--title',
        'this is a title'
    ]
    
*/

license

MIT