1.2.3 • Published 9 years ago

shell-arguments v1.2.3

Weekly downloads
47
License
MIT
Repository
github
Last release
9 years ago

Build Status Coverage Status npm version MIT Licence

shell-arguments

This module serialize the arguments passed to the npm, node, nodemon, forever, or pm2, and convert this arguments to json.

Install

npm install --save shell-arguments

and in your .js file

import arguments from 'shell-arguments';

console.log(arguments);

now, var arguments, return a object, with your data, example:

node app.js -b --test
=> {b: true, test: true}

If you want apply false, use

node app.js -b=false --test="false"
=> {b: false, test: false}

Note that the string with false value was converted to a boolean false, because this module convert primitive values.

Too accept other values, like below:

node app.js -o '/Desktop/teste' --output="/Desktop/teste"
=> {o: '/Desktop/teste', output: '/Desktop/teste'}

Convert primitive values

node app.js --port 8080 --numbers="2", --allow="false" --private="true"
=> {port: 8080, numbers: 2, allow: false, private: true}

Multiple flags with a single -, example:

node app.js -rpqs
=> {r: true, p: true, q: true, s: true}

Apply value with =, or space:

node app.js --output '/Desktop/test' --config="test"
=> {output: '/Desktop/test', config: 'test'}
1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.9

9 years ago

1.1.7

9 years ago

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago