Yargs
Yargs be a node.js library fer hearties tryin' ter parse optstrings
Description :
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
It gives you:
- commands and (grouped) options (
my-program.js serve --port=5000
). - a dynamically generated help menu based on your arguments.
- bash-completion shortcuts for commands and options.
- and tons more.
Installation
Stable version:
npm i yargs --save
Bleeding edge version with the most recent features:
npm i yargs@next --save
Usage :
Simple Example
#!/usr/bin/env nodeconst argv = argv if argvships > 3 && argvdistance < 535 console else console
$ ./plunder.js --ships=4 --distance=22Plunder more riffiwobbles! $ ./plunder.js --ships 12 --distance 98.7Retreat from the xupptumblers!
Complex Example
#!/usr/bin/env node // eslint-disable-line argv
Run the example above with --help
to see the help for the application.
Community :
Having problems? want to contribute? join our community slack.