2 <img width="250" src="/yargs-logo.png">
4 <h1 align="center"> Yargs </h1>
6 <b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b>
10 [![Build Status][travis-image]][travis-url]
11 [![Coverage Status][coveralls-image]][coveralls-url]
12 [![NPM version][npm-image]][npm-url]
13 [![js-standard-style][standard-image]][standard-url]
14 [![Conventional Commits][conventional-commits-image]][conventional-commits-url]
15 [![Slack][slack-image]][slack-url]
18 Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
22 * commands and (grouped) options (`my-program.js serve --port=5000`).
23 * a dynamically generated help menu based on your arguments.
25 > <img width="400" src="/screen.png">
27 * bash-completion shortcuts for commands and options.
28 * and [tons more](/docs/api.md).
37 Bleeding edge version with the most recent features:
48 const argv = require('yargs').argv
50 if (argv.ships > 3 && argv.distance < 53.5) {
51 console.log('Plunder more riffiwobbles!')
53 console.log('Retreat from the xupptumblers!')
58 $ ./plunder.js --ships=4 --distance=22
59 Plunder more riffiwobbles!
61 $ ./plunder.js --ships 12 --distance 98.7
62 Retreat from the xupptumblers!
69 require('yargs') // eslint-disable-line
70 .command('serve [port]', 'start the server', (yargs) => {
73 describe: 'port to bind on',
77 if (argv.verbose) console.info(`start server on :${argv.port}`)
87 Run the example above with `--help` to see the help for the application.
91 Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
97 * [Yargs' API](/docs/api.md)
98 * [Examples](/docs/examples.md)
99 * [Parsing Tricks](/docs/tricks.md)
100 * [Stop the Parser](/docs/tricks.md#stop)
101 * [Negating Boolean Arguments](/docs/tricks.md#negate)
102 * [Numbers](/docs/tricks.md#numbers)
103 * [Arrays](/docs/tricks.md#arrays)
104 * [Objects](/docs/tricks.md#objects)
105 * [Advanced Topics](/docs/advanced.md)
106 * [Composing Your App Using Commands](/docs/advanced.md#commands)
107 * [Building Configurable CLI Apps](/docs/advanced.md#configuration)
108 * [Customizing Yargs' Parser](/docs/advanced.md#customizing)
109 * [Contributing](/contributing.md)
111 [travis-url]: https://travis-ci.org/yargs/yargs
112 [travis-image]: https://img.shields.io/travis/yargs/yargs/master.svg
113 [coveralls-url]: https://coveralls.io/github/yargs/yargs
114 [coveralls-image]: https://img.shields.io/coveralls/yargs/yargs.svg
115 [npm-url]: https://www.npmjs.com/package/yargs
116 [npm-image]: https://img.shields.io/npm/v/yargs.svg
117 [standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
118 [standard-url]: http://standardjs.com/
119 [conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
120 [conventional-commits-url]: https://conventionalcommits.org/
121 [slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
122 [slack-url]: http://devtoolscommunity.herokuapp.com