request-arguments
v1.0.2
Published
Request params by arguments or prompt
Downloads
6
Maintainers
Readme
request-arguments
Request params by arguments or prompt
Installation
To install this library, run:
$ npm i -s request-arguments
Clone this repository locally :
$ git clone https://github.com/goekaypamuk/request-arguments
Example of use
Import and use (index.js):
import { requestArguments } from 'request-arguments';
requestArguments([
{
name: 'port',
description: 'Port for connection',
short: 'p',
mandatory: true
},
{
name: 'controllerPort',
description: 'Port of Controller',
short: 'c',
mandatory: true
},
{
name: 'controllerLink',
description: 'Ip of Controller',
short: 'i',
mandatory: true
}
]).then(
function(b) {
console.log(b)
}
)
You can now use -h flag to print out params:
$ node index -h
output:
***********************************************************
***** Request Arguments HELP ******************************
***********************************************************
-p :port Port for connection
-c :controllerPort Port of Controller
-i :controllerLink Ip of Controller
***********************************************************
$ node index -p 5555
Missing manadtory arguments!
? Port of Controller 444
? Ip of Controller localhost
{ p: 5555, c: '444', i: 'localhost' }
License
MIT © Gökay Pamuk