1.2.3 • Published 7 years ago

shell-arguments v1.2.3

Weekly downloads
47
License
MIT
Repository
github
Last release
7 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

7 years ago

1.2.2

7 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.9

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.0.9

8 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago