Skip to content

goekaypamuk/request-arguments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Request params by arguments or prompt

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published