1. spawn-args
Turn a string of command line options into an array for child_process.spawn
spawn-args
Package: spawn-args
Created by: binocarlos
Last modified: Sun, 26 Jun 2022 22:38:03 GMT
Version: 0.2.0
License: MIT
Downloads: 654,153
Repository: https://github.com/binocarlos/spawn-args

Install

npm install spawn-args
yarn add spawn-args

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

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin