spawn-args
Turn a string of command line options into an array for child_process.spawn
Last updated 11 years ago by binocarlos .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install spawn-args 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.2.0                                ...           latest (10 years ago)

5 Versions

  • 0.2.0                                ...           10 years ago
  • 0.1.0                                ...           11 years ago
  • 0.0.4                                ...           12 years ago
  • 0.0.3                                ...           12 years ago
  • 0.0.2                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |