source: trip-planner-front/node_modules/yargs/README.md@ 76712b2

Last change on this file since 76712b2 was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[6a3a178]1<p align="center">
[e29cc2e]2 <img width="250" src="/yargs-logo.png">
[6a3a178]3</p>
4<h1 align="center"> Yargs </h1>
5<p align="center">
6 <b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b>
7</p>
8<br>
9
[e29cc2e]10[![Build Status][travis-image]][travis-url]
11[![Coverage Status][coveralls-image]][coveralls-url]
[6a3a178]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]
16
[e29cc2e]17## Description :
18Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
[6a3a178]19
20It gives you:
21
22* commands and (grouped) options (`my-program.js serve --port=5000`).
[e29cc2e]23* a dynamically generated help menu based on your arguments.
[6a3a178]24
[e29cc2e]25> <img width="400" src="/screen.png">
[6a3a178]26
27* bash-completion shortcuts for commands and options.
28* and [tons more](/docs/api.md).
29
30## Installation
31
32Stable version:
33```bash
34npm i yargs
35```
36
37Bleeding edge version with the most recent features:
38```bash
39npm i yargs@next
40```
41
[e29cc2e]42## Usage :
[6a3a178]43
44### Simple Example
45
[e29cc2e]46````javascript
[6a3a178]47#!/usr/bin/env node
[e29cc2e]48const argv = require('yargs').argv
[6a3a178]49
50if (argv.ships > 3 && argv.distance < 53.5) {
51 console.log('Plunder more riffiwobbles!')
52} else {
53 console.log('Retreat from the xupptumblers!')
54}
[e29cc2e]55````
[6a3a178]56
57```bash
58$ ./plunder.js --ships=4 --distance=22
59Plunder more riffiwobbles!
60
61$ ./plunder.js --ships 12 --distance 98.7
62Retreat from the xupptumblers!
63```
64
65### Complex Example
66
67```javascript
68#!/usr/bin/env node
[e29cc2e]69require('yargs') // eslint-disable-line
[6a3a178]70 .command('serve [port]', 'start the server', (yargs) => {
[e29cc2e]71 yargs
[6a3a178]72 .positional('port', {
73 describe: 'port to bind on',
74 default: 5000
75 })
76 }, (argv) => {
77 if (argv.verbose) console.info(`start server on :${argv.port}`)
78 serve(argv.port)
79 })
80 .option('verbose', {
81 alias: 'v',
[e29cc2e]82 default: false
[6a3a178]83 })
[e29cc2e]84 .argv
[6a3a178]85```
86
87Run the example above with `--help` to see the help for the application.
88
[e29cc2e]89## Community :
[6a3a178]90
91Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
92
[e29cc2e]93## Documentation :
[6a3a178]94
95### Table of Contents
96
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)
110
[e29cc2e]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
[6a3a178]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
Note: See TracBrowser for help on using the repository browser.