3 [![Build Status][travis-image]][travis-url]
4 [![Coverage Status][coveralls-image]][coveralls-url]
5 [![NPM version][npm-image]][npm-url]
6 [![Windows Tests][windows-image]][windows-url]
7 [![js-standard-style][standard-image]][standard-url]
8 [![Conventional Commits][conventional-commits-image]][conventional-commits-url]
9 [![Slack][slack-image]][slack-url]
11 _Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com)_.
13 > Yargs be a node.js library fer hearties tryin' ter parse optstrings.
15 <img width="250" src="/yargs-logo.png">
17 Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. It gives you:
19 * commands and (grouped) options (`my-program.js serve --port=5000`).
20 * a dynamically generated help menu based on your arguments.
22 > <img width="400" src="/screen.png">
24 * bash-completion shortcuts for commands and options.
25 * and [tons more](/docs/api.md).
37 const argv = require('yargs').argv
39 if (argv.ships > 3 && argv.distance < 53.5) {
40 console.log('Plunder more riffiwobbles!')
42 console.log('Retreat from the xupptumblers!')
47 $ ./plunder.js --ships=4 --distance=22
48 Plunder more riffiwobbles!
50 $ ./plunder.js --ships 12 --distance 98.7
51 Retreat from the xupptumblers!
58 require('yargs') // eslint-disable-line
59 .command('serve [port]', 'start the server', (yargs) => {
62 describe: 'port to bind on',
66 if (argv.verbose) console.info(`start server on :${argv.port}`)
76 Run the example above with `--help` to see the help for the application.
80 * [Yargs' API](/docs/api.md)
81 * [Examples](/docs/examples.md)
82 * [Parsing Tricks](/docs/tricks.md)
83 * [Stop the Parser](/docs/tricks.md#stop)
84 * [Negating Boolean Arguments](/docs/tricks.md#negate)
85 * [Numbers](/docs/tricks.md#numbers)
86 * [Arrays](/docs/tricks.md#arrays)
87 * [Objects](/docs/tricks.md#objects)
88 * [Advanced Topics](/docs/advanced.md)
89 * [Composing Your App Using Commands](/docs/advanced.md#commands)
90 * [Building Configurable CLI Apps](/docs/advanced.md#configuration)
91 * [Customizing Yargs' Parser](/docs/advanced.md#customizing)
92 * [Contributing](/contributing.md)
94 [travis-url]: https://travis-ci.org/yargs/yargs
95 [travis-image]: https://img.shields.io/travis/yargs/yargs/master.svg
96 [coveralls-url]: https://coveralls.io/github/yargs/yargs
97 [coveralls-image]: https://img.shields.io/coveralls/yargs/yargs.svg
98 [npm-url]: https://www.npmjs.com/package/yargs
99 [npm-image]: https://img.shields.io/npm/v/yargs.svg
100 [windows-url]: https://ci.appveyor.com/project/bcoe/yargs-ljwvf
101 [windows-image]: https://img.shields.io/appveyor/ci/bcoe/yargs-ljwvf/master.svg?label=Windows%20Tests
102 [standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
103 [standard-url]: http://standardjs.com/
104 [conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
105 [conventional-commits-url]: https://conventionalcommits.org/
106 [slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
107 [slack-url]: http://devtoolscommunity.herokuapp.com