cpg

cli-parameter-getter

From CLI you can get any parameter from it order or parameter name

Showing:

Popularity

Downloads/wk

1

GitHub Stars

2

Maintenance

Last Commit

4mos ago

Contributors

2

Package

Dependencies

0

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

cli-parameter-getter CircleCI

From CLI you can get any parameter from it order or parameter name. Node.js version >= 6

npm install cli-parameter-getter

Examples

Get a parameter from it order

  • You can use this:
node index.js 1337
  • Implementing this way:
const cliParameters = require('cli-parameter-getter').get()
 
const portParameter = cliParameters[0]
console.log(portParameter)
// { name: '1337', value: '1337' } 

Get a parameter from it name or order

  • You can use this:
node index.js port=1337
  • Implementing this way:
const cliParameters = require('cli-parameter-getter').get()
 
const port = cliParameters.port
console.log(port)
// 1337 
 
const portParameter = cliParameters[0]
console.log(portParameter)
// { name: 'port', value: '1337' }

Get a parameter from mixed situations

  • You can use this:
node index.js port=1337 app-test
  • Implementing this way:
const cliParameters = require('cli-parameter-getter').get()
 
const port = cliParameters.port
console.log(port)
// 1337 
 
const portParameter = cliParameters[0]
console.log(portParameter)
// { name: 'port', value: '1337' } 
 
const nameParameter = cliParameters[1]
console.log(nameParameter)
// { name: 'app-test', value: 'app-test' }

You can test the package:

How to dev

  • Releases
npx release-it

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial