spawn-args

0.2.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    153,452
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    153,452
  • 0.1.0
    394
  • 0.0.4
    25
  • 0.0.3
    1
  • 0.0.2
    1

Package Sidebar

Install

npm i spawn-args

Weekly Downloads

153,873

Version

0.2.0

License

MIT

Last publish

Collaborators

  • binocarlos