Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <p align="center">
  2. <img width="250" src="https://raw.githubusercontent.com/yargs/yargs/master/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. ![ci](https://github.com/yargs/yargs/workflows/ci/badge.svg)
  10. [![NPM version][npm-image]][npm-url]
  11. [![js-standard-style][standard-image]][standard-url]
  12. [![Coverage][coverage-image]][coverage-url]
  13. [![Conventional Commits][conventional-commits-image]][conventional-commits-url]
  14. [![Slack][slack-image]][slack-url]
  15. ## Description
  16. Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
  17. It gives you:
  18. * commands and (grouped) options (`my-program.js serve --port=5000`).
  19. * a dynamically generated help menu based on your arguments:
  20. ```
  21. mocha [spec..]
  22. Run tests with Mocha
  23. Commands
  24. mocha inspect [spec..] Run tests with Mocha [default]
  25. mocha init <path> create a client-side Mocha setup at <path>
  26. Rules & Behavior
  27. --allow-uncaught Allow uncaught errors to propagate [boolean]
  28. --async-only, -A Require all tests to use a callback (async) or
  29. return a Promise [boolean]
  30. ```
  31. * bash-completion shortcuts for commands and options.
  32. * and [tons more](/docs/api.md).
  33. ## Installation
  34. Stable version:
  35. ```bash
  36. npm i yargs
  37. ```
  38. Bleeding edge version with the most recent features:
  39. ```bash
  40. npm i yargs@next
  41. ```
  42. ## Usage
  43. ### Simple Example
  44. ```javascript
  45. #!/usr/bin/env node
  46. const yargs = require('yargs/yargs')
  47. const { hideBin } = require('yargs/helpers')
  48. const argv = yargs(hideBin(process.argv)).argv
  49. if (argv.ships > 3 && argv.distance < 53.5) {
  50. console.log('Plunder more riffiwobbles!')
  51. } else {
  52. console.log('Retreat from the xupptumblers!')
  53. }
  54. ```
  55. ```bash
  56. $ ./plunder.js --ships=4 --distance=22
  57. Plunder more riffiwobbles!
  58. $ ./plunder.js --ships 12 --distance 98.7
  59. Retreat from the xupptumblers!
  60. ```
  61. ### Complex Example
  62. ```javascript
  63. #!/usr/bin/env node
  64. const yargs = require('yargs/yargs')
  65. const { hideBin } = require('yargs/helpers')
  66. yargs(hideBin(process.argv))
  67. .command('serve [port]', 'start the server', (yargs) => {
  68. yargs
  69. .positional('port', {
  70. describe: 'port to bind on',
  71. default: 5000
  72. })
  73. }, (argv) => {
  74. if (argv.verbose) console.info(`start server on :${argv.port}`)
  75. serve(argv.port)
  76. })
  77. .option('verbose', {
  78. alias: 'v',
  79. type: 'boolean',
  80. description: 'Run with verbose logging'
  81. })
  82. .argv
  83. ```
  84. Run the example above with `--help` to see the help for the application.
  85. ## Supported Platforms
  86. ### TypeScript
  87. yargs has type definitions at [@types/yargs][type-definitions].
  88. ```
  89. npm i @types/yargs --save-dev
  90. ```
  91. See usage examples in [docs](/docs/typescript.md).
  92. ### Deno
  93. As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):
  94. ```typescript
  95. import yargs from 'https://deno.land/x/yargs/deno.ts'
  96. import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'
  97. yargs(Deno.args)
  98. .command('download <files...>', 'download a list of files', (yargs: any) => {
  99. return yargs.positional('files', {
  100. describe: 'a list of files to do something with'
  101. })
  102. }, (argv: Arguments) => {
  103. console.info(argv)
  104. })
  105. .strictCommands()
  106. .demandCommand(1)
  107. .argv
  108. ```
  109. ### ESM
  110. As of `v16`,`yargs` supports ESM imports:
  111. ```js
  112. import yargs from 'yargs'
  113. import { hideBin } from 'yargs/helpers'
  114. yargs(hideBin(process.argv))
  115. .command('curl <url>', 'fetch the contents of the URL', () => {}, (argv) => {
  116. console.info(argv)
  117. })
  118. .demandCommand(1)
  119. .argv
  120. ```
  121. ### Usage in Browser
  122. See examples of using yargs in the browser in [docs](/docs/browser.md).
  123. ## Community
  124. Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
  125. ## Documentation
  126. ### Table of Contents
  127. * [Yargs' API](/docs/api.md)
  128. * [Examples](/docs/examples.md)
  129. * [Parsing Tricks](/docs/tricks.md)
  130. * [Stop the Parser](/docs/tricks.md#stop)
  131. * [Negating Boolean Arguments](/docs/tricks.md#negate)
  132. * [Numbers](/docs/tricks.md#numbers)
  133. * [Arrays](/docs/tricks.md#arrays)
  134. * [Objects](/docs/tricks.md#objects)
  135. * [Quotes](/docs/tricks.md#quotes)
  136. * [Advanced Topics](/docs/advanced.md)
  137. * [Composing Your App Using Commands](/docs/advanced.md#commands)
  138. * [Building Configurable CLI Apps](/docs/advanced.md#configuration)
  139. * [Customizing Yargs' Parser](/docs/advanced.md#customizing)
  140. * [Bundling yargs](/docs/bundling.md)
  141. * [Contributing](/contributing.md)
  142. ## Supported Node.js Versions
  143. Libraries in this ecosystem make a best effort to track
  144. [Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
  145. post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
  146. [npm-url]: https://www.npmjs.com/package/yargs
  147. [npm-image]: https://img.shields.io/npm/v/yargs.svg
  148. [standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
  149. [standard-url]: http://standardjs.com/
  150. [conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
  151. [conventional-commits-url]: https://conventionalcommits.org/
  152. [slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
  153. [slack-url]: http://devtoolscommunity.herokuapp.com
  154. [type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
  155. [coverage-image]: https://img.shields.io/nycrc/yargs/yargs
  156. [coverage-url]: https://github.com/yargs/yargs/blob/master/.nycrc