Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/spawn-args
Turn a string of command line options into an array for child_process.spawn
https://github.com/binocarlos/spawn-args
Last synced: 10 days ago
JSON representation
Turn a string of command line options into an array for child_process.spawn
- Host: GitHub
- URL: https://github.com/binocarlos/spawn-args
- Owner: binocarlos
- License: mit
- Created: 2014-04-05T22:26:21.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-01-15T20:15:39.000Z (almost 7 years ago)
- Last Synced: 2024-10-28T14:59:47.712Z (23 days ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 15
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
spawn-args
==========![Build status](https://api.travis-ci.org/binocarlos/spawn-args.png)
Turn a string of command line options into an array for child_process.spawn
## install
```
$ npm install spawn-args
```## usage
```js
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
```js
var args2 = spawnargs('-port 80 --color "red" --title "this is a title"', { removequotes: true });/*
[
'-port',
'80',
'--color',
'red',
'--title',
'"this is a title"'
]
*/
```If `removequotes` is `always` then quotes will be removed even if the value contains spaces
```js
var args3 = spawnargs('-port 80 --color "red" --title "this is a title"', { removequotes: 'always' });/*
[
'-port',
'80',
'--color',
'red',
'--title',
'this is a title'
]
*/
```## license
MIT