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

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

primeNG components

  • Property mode set to 100644
File size: 3.4 KB
Line 
1<p align="center">
2 <img width="250" src="/yargs-logo.png">
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
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]
16
17## Description :
18Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
19
20It gives you:
21
22* commands and (grouped) options (`my-program.js serve --port=5000`).
23* a dynamically generated help menu based on your arguments.
24
25> <img width="400" src="/screen.png">
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
42## Usage :
43
44### Simple Example
45
46````javascript
47#!/usr/bin/env node
48const argv = require('yargs').argv
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}
55````
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
69require('yargs') // eslint-disable-line
70 .command('serve [port]', 'start the server', (yargs) => {
71 yargs
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',
82 default: false
83 })
84 .argv
85```
86
87Run the example above with `--help` to see the help for the application.
88
89## Community :
90
91Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
92
93## Documentation :
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
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
Note: See TracBrowser for help on using the repository browser.