Changeset e29cc2e for trip-planner-front/node_modules/yargs/README.md
- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/yargs/README.md
r59329aa re29cc2e 1 1 <p align="center"> 2 <img width="250" src=" https://raw.githubusercontent.com/yargs/yargs/main/yargs-logo.png">2 <img width="250" src="/yargs-logo.png"> 3 3 </p> 4 4 <h1 align="center"> Yargs </h1> … … 6 6 <b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b> 7 7 </p> 8 9 8 <br> 10 9 11 ![ci](https://github.com/yargs/yargs/workflows/ci/badge.svg) 10 [![Build Status][travis-image]][travis-url] 11 [![Coverage Status][coveralls-image]][coveralls-url] 12 12 [![NPM version][npm-image]][npm-url] 13 13 [![js-standard-style][standard-image]][standard-url] 14 [![Coverage][coverage-image]][coverage-url]15 14 [![Conventional Commits][conventional-commits-image]][conventional-commits-url] 16 15 [![Slack][slack-image]][slack-url] 17 16 18 ## Description 19 Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. 17 ## Description : 18 Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. 20 19 21 20 It gives you: 22 21 23 22 * commands and (grouped) options (`my-program.js serve --port=5000`). 24 * a dynamically generated help menu based on your arguments :23 * a dynamically generated help menu based on your arguments. 25 24 26 ``` 27 mocha [spec..] 28 29 Run tests with Mocha 30 31 Commands 32 mocha inspect [spec..] Run tests with Mocha [default] 33 mocha init <path> create a client-side Mocha setup at <path> 34 35 Rules & Behavior 36 --allow-uncaught Allow uncaught errors to propagate [boolean] 37 --async-only, -A Require all tests to use a callback (async) or 38 return a Promise [boolean] 39 ``` 25 > <img width="400" src="/screen.png"> 40 26 41 27 * bash-completion shortcuts for commands and options. … … 54 40 ``` 55 41 56 ## Usage 42 ## Usage : 57 43 58 44 ### Simple Example 59 45 60 ``` javascript46 ````javascript 61 47 #!/usr/bin/env node 62 const yargs = require('yargs/yargs') 63 const { hideBin } = require('yargs/helpers') 64 const argv = yargs(hideBin(process.argv)).argv 48 const argv = require('yargs').argv 65 49 66 50 if (argv.ships > 3 && argv.distance < 53.5) { … … 69 53 console.log('Retreat from the xupptumblers!') 70 54 } 71 ``` 55 ```` 72 56 73 57 ```bash … … 79 63 ``` 80 64 81 > Note: `hideBin` is a shorthand for [`process.argv.slice(2)`](https://nodejs.org/en/knowledge/command-line/how-to-parse-command-line-arguments/). It has the benefit that it takes into account variations in some environments, e.g., [Electron](https://github.com/electron/electron/issues/4690).82 83 65 ### Complex Example 84 66 85 67 ```javascript 86 68 #!/usr/bin/env node 87 const yargs = require('yargs/yargs') 88 const { hideBin } = require('yargs/helpers') 89 90 yargs(hideBin(process.argv)) 69 require('yargs') // eslint-disable-line 91 70 .command('serve [port]', 'start the server', (yargs) => { 92 returnyargs71 yargs 93 72 .positional('port', { 94 73 describe: 'port to bind on', … … 101 80 .option('verbose', { 102 81 alias: 'v', 103 type: 'boolean', 104 description: 'Run with verbose logging' 82 default: false 105 83 }) 106 . parse()84 .argv 107 85 ``` 108 86 109 87 Run the example above with `--help` to see the help for the application. 110 88 111 ## Supported Platforms 112 113 ### TypeScript 114 115 yargs has type definitions at [@types/yargs][type-definitions]. 116 117 ``` 118 npm i @types/yargs --save-dev 119 ``` 120 121 See usage examples in [docs](/docs/typescript.md). 122 123 ### Deno 124 125 As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno): 126 127 ```typescript 128 import yargs from 'https://deno.land/x/yargs/deno.ts' 129 import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts' 130 131 yargs(Deno.args) 132 .command('download <files...>', 'download a list of files', (yargs: any) => { 133 return yargs.positional('files', { 134 describe: 'a list of files to do something with' 135 }) 136 }, (argv: Arguments) => { 137 console.info(argv) 138 }) 139 .strictCommands() 140 .demandCommand(1) 141 .parse() 142 ``` 143 144 ### ESM 145 146 As of `v16`,`yargs` supports ESM imports: 147 148 ```js 149 import yargs from 'yargs' 150 import { hideBin } from 'yargs/helpers' 151 152 yargs(hideBin(process.argv)) 153 .command('curl <url>', 'fetch the contents of the URL', () => {}, (argv) => { 154 console.info(argv) 155 }) 156 .demandCommand(1) 157 .parse() 158 ``` 159 160 ### Usage in Browser 161 162 See examples of using yargs in the browser in [docs](/docs/browser.md). 163 164 ## Community 89 ## Community : 165 90 166 91 Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com). 167 92 168 ## Documentation 93 ## Documentation : 169 94 170 95 ### Table of Contents … … 178 103 * [Arrays](/docs/tricks.md#arrays) 179 104 * [Objects](/docs/tricks.md#objects) 180 * [Quotes](/docs/tricks.md#quotes)181 105 * [Advanced Topics](/docs/advanced.md) 182 106 * [Composing Your App Using Commands](/docs/advanced.md#commands) 183 107 * [Building Configurable CLI Apps](/docs/advanced.md#configuration) 184 108 * [Customizing Yargs' Parser](/docs/advanced.md#customizing) 185 * [Bundling yargs](/docs/bundling.md)186 109 * [Contributing](/contributing.md) 187 110 188 ## Supported Node.js Versions 189 190 Libraries in this ecosystem make a best effort to track 191 [Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a 192 post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a). 193 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 194 115 [npm-url]: https://www.npmjs.com/package/yargs 195 116 [npm-image]: https://img.shields.io/npm/v/yargs.svg … … 200 121 [slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg 201 122 [slack-url]: http://devtoolscommunity.herokuapp.com 202 [type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/main/types/yargs203 [coverage-image]: https://img.shields.io/nycrc/yargs/yargs204 [coverage-url]: https://github.com/yargs/yargs/blob/main/.nycrc
Note:
See TracChangeset
for help on using the changeset viewer.