UNPKG

pnpm

Version:

Fast, disk space efficient package manager

124 lines (123 loc) • 12.7 kB
{ "_args": [ [ { "raw": "yargs-parser@^11.1.1", "scope": null, "escapedName": "yargs-parser", "name": "yargs-parser", "rawSpec": "^11.1.1", "spec": ">=11.1.1 <12.0.0", "type": "range" }, "/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/yargs" ] ], "_from": "yargs-parser@^11.1.1", "_hasShrinkwrap": false, "_id": "yargs-parser@11.1.1", "_location": "/yargs-parser", "_nodeVersion": "10.11.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/yargs-parser_11.1.1_1542670464133_0.8836926394269116" }, "_npmUser": { "name": "bcoe", "email": "ben@npmjs.com" }, "_npmVersion": "6.4.1", "_phantomChildren": {}, "_requested": { "raw": "yargs-parser@^11.1.1", "scope": null, "escapedName": "yargs-parser", "name": "yargs-parser", "rawSpec": "^11.1.1", "spec": ">=11.1.1 <12.0.0", "type": "range" }, "_requiredBy": [ "/yargs" ], "_resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", "_shasum": "879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4", "_shrinkwrap": null, "_spec": "yargs-parser@^11.1.1", "_where": "/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/yargs", "author": { "name": "Ben Coe", "email": "ben@npmjs.com" }, "bugs": { "url": "https://github.com/yargs/yargs-parser/issues" }, "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" }, "description": "the mighty option parser used by yargs", "devDependencies": { "chai": "^4.2.0", "coveralls": "^3.0.2", "mocha": "^5.2.0", "nyc": "^13.0.1", "standard": "^12.0.1", "standard-version": "^4.4.0" }, "directories": {}, "dist": { "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", "shasum": "879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4", "tarball": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", "fileCount": 6, "unpackedSize": 52233, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb80iACRA9TVsSAnZWagAAxs0QAIRQ2lljZeAf38/jR/2I\nRRkUHNxY9KOCKuprpUeTgpKEVd3XLNHhra9K7/HegBZJM1vVYv6PJGHBBNwa\neTDdbZqS5+f96xAg8IrzOeiFIdxB0YRYZKb2CWVhXmMiM/bkF8hZik7OyD9H\nFv+iOdnVTPaJkN2jfNgTV6HJPWz9nqjoRSXgiPCdBTP+F9aNedL1iuXkBkm+\nUesV4A6iV8tvEK/tR27hv6ddS+S9nOKiRDoxQPdpKb2CdGc5mibwvcGpaWYO\nJXuqbIJ6z11Y8vEX0+mMO8CcDqjeK9NhGupPyndNLpDThiykvvMsNXWWtsOI\nVcax/maPi1UOCCA++1q5Ln7x7vJIkvhfNrXWSgs0Swf/l19MIm6NfE7eSc/s\nqzq9WT/CqDTV04YD0fk657nundlY+CRKufKbBFgcHUBG8i7xXQMzz6VJl8hX\nkgL/kz9ihMJCCrWkkg3YzCwiuzwhvt4PXzFbHUlTyIgZKrNkN/UBxXWIqg5Z\nqrkIANPjzoFQTGcQR3zugRCMPudWmxiOgys5h+Z8D4VdSBr8ZuVNfVna6ckx\nNKPztRUckneWlS06+DDbgxtzi0YzKIt7S2l33RyAv4i1oQt8hAQ44yp0zLH1\nz8HgMP/Z8bHOG4UvemudHi6pY5vAxvmf/69x8BAp6ycGbRsIaZ0LzptLzbya\nvhlx\r\n=9XdU\r\n-----END PGP SIGNATURE-----\r\n" }, "engine": { "node": ">=6" }, "files": [ "lib", "index.js" ], "gitHead": "ee122f89ab9417241b06c6b3ce6aabb2ac8ce5f2", "homepage": "https://github.com/yargs/yargs-parser#readme", "keywords": [ "argument", "parser", "yargs", "command", "cli", "parsing", "option", "args", "argument" ], "license": "ISC", "main": "index.js", "maintainers": [ { "name": "bcoe", "email": "ben@npmjs.com" }, { "name": "nexdrew", "email": "andrewbgoode@gmail.com" } ], "name": "yargs-parser", "optionalDependencies": {}, "readme": "# yargs-parser\n\n[![Build Status](https://travis-ci.org/yargs/yargs-parser.svg)](https://travis-ci.org/yargs/yargs-parser)\n[![Coverage Status](https://coveralls.io/repos/yargs/yargs-parser/badge.svg?branch=)](https://coveralls.io/r/yargs/yargs-parser?branch=master)\n[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser)\n[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)\n\n\nThe mighty option parser used by [yargs](https://github.com/yargs/yargs).\n\nvisit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.\n\n<img width=\"250\" src=\"https://raw.githubusercontent.com/yargs/yargs-parser/master/yargs-logo.png\">\n\n## Example\n\n```sh\nnpm i yargs-parser --save\n```\n\n```js\nvar argv = require('yargs-parser')(process.argv.slice(2))\nconsole.log(argv)\n```\n\n```sh\nnode example.js --foo=33 --bar hello\n{ _: [], foo: 33, bar: 'hello' }\n```\n\n_or parse a string!_\n\n```js\nvar argv = require('./')('--foo=99 --bar=33')\nconsole.log(argv)\n```\n\n```sh\n{ _: [], foo: 99, bar: 33 }\n```\n\nConvert an array of mixed types before passing to `yargs-parser`:\n\n```js\nvar parse = require('yargs-parser')\nparse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string\nparse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings\n```\n\n## API\n\n### require('yargs-parser')(args, opts={})\n\nParses command line arguments returning a simple mapping of keys and values.\n\n**expects:**\n\n* `args`: a string or array of strings representing the options to parse.\n* `opts`: provide a set of hints indicating how `args` should be parsed:\n * `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`.\n * `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.\n Indicate that keys should be parsed as an array and coerced to booleans / numbers:\n `{array: [{ key: 'foo', boolean: true }, {key: 'bar', number: true}]}`.\n * `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`.\n * `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed).\n * `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided\n (or throws an error), e.g. `{coerce: {foo: function (arg) {return modifiedArg}}}`.\n * `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`.\n * `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`.\n * `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed.\n * `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`.\n * `opts.normalize`: `path.normalize()` will be applied to values set to this key.\n * `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`).\n * `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)).\n * `opts.number`: keys should be treated as numbers.\n * `opts['--']`: arguments after the end-of-options flag `--` will be set to the `argv.['--']` array instead of being set to the `argv._` array.\n\n**returns:**\n\n* `obj`: an object representing the parsed value of `args`\n * `key/value`: key value pairs for each argument and their aliases.\n * `_`: an array representing the positional arguments.\n * [optional] `--`: an array with arguments after the end-of-options flag `--`.\n\n### require('yargs-parser').detailed(args, opts={})\n\nParses a command line string, returning detailed information required by the\nyargs engine.\n\n**expects:**\n\n* `args`: a string or array of strings representing options to parse.\n* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`.\n\n**returns:**\n\n* `argv`: an object representing the parsed value of `args`\n * `key/value`: key value pairs for each argument and their aliases.\n * `_`: an array representing the positional arguments.\n* `error`: populated with an error object if an exception occurred during parsing.\n* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`.\n* `newAliases`: any new aliases added via camel-case expansion.\n* `configuration`: the configuration loaded from the `yargs` stanza in package.json.\n\n<a name=\"configuration\"></a>\n\n### Configuration\n\nThe yargs-parser applies several automated transformations on the keys provided\nin `args`. These features can be turned on and off using the `configuration` field\nof `opts`.\n\n```js\nvar parsed = parser(['--no-dice'], {\n configuration: {\n 'boolean-negation': false\n }\n})\n```\n\n### short option groups\n\n* default: `true`.\n* key: `short-option-groups`.\n\nShould a group of short-options be treated as boolean flags?\n\n```sh\nnode example.js -abc\n{ _: [], a: true, b: true, c: true }\n```\n\n_if disabled:_\n\n```sh\nnode example.js -abc\n{ _: [], abc: true }\n```\n\n### camel-case expansion\n\n* default: `true`.\n* key: `camel-case-expansion`.\n\nShould hyphenated arguments be expanded into camel-case aliases?\n\n```sh\nnode example.js --foo-bar\n{ _: [], 'foo-bar': true, fooBar: true }\n```\n\n_if disabled:_\n\n```sh\nnode example.js --foo-bar\n{ _: [], 'foo-bar': true }\n```\n\n### dot-notation\n\n* default: `true`\n* key: `dot-notation`\n\nShould keys that contain `.` be treated as objects?\n\n```sh\nnode example.js --foo.bar\n{ _: [], foo: { bar: true } }\n```\n\n_if disabled:_\n\n```sh\nnode example.js --foo.bar\n{ _: [], \"foo.bar\": true }\n```\n\n### parse numbers\n\n* default: `true`\n* key: `parse-numbers`\n\nShould keys that look like numbers be treated as such?\n\n```sh\nnode example.js --foo=99.3\n{ _: [], foo: 99.3 }\n```\n\n_if disabled:_\n\n```sh\nnode example.js --foo=99.3\n{ _: [], foo: \"99.3\" }\n```\n\n### boolean negation\n\n* default: `true`\n* key: `boolean-negation`\n\nShould variables prefixed with `--no` be treated as negations?\n\n```sh\nnode example.js --no-foo\n{ _: [], foo: false }\n```\n\n_if disabled:_\n\n```sh\nnode example.js --no-foo\n{ _: [], \"no-foo\": true }\n```\n\n### combine arrays\n\n* default: `false`\n* key: `combine-arrays`\n\nShould arrays be combined when provided by both command line arguments and\na configuration file.\n\n### duplicate arguments array\n\n* default: `true`\n* key: `duplicate-arguments-array`\n\nShould arguments be coerced into an array when duplicated:\n\n```sh\nnode example.js -x 1 -x 2\n{ _: [], x: [1, 2] }\n```\n\n_if disabled:_\n\n```sh\nnode example.js -x 1 -x 2\n{ _: [], x: 2 }\n```\n\n### flatten duplicate arrays\n\n* default: `true`\n* key: `flatten-duplicate-arrays`\n\nShould array arguments be coerced into a single array when duplicated:\n\n```sh\nnode example.js -x 1 2 -x 3 4\n{ _: [], x: [1, 2, 3, 4] }\n```\n\n_if disabled:_\n\n```sh\nnode example.js -x 1 2 -x 3 4\n{ _: [], x: [[1, 2], [3, 4]] }\n```\n\n### negation prefix\n\n* default: `no-`\n* key: `negation-prefix`\n\nThe prefix to use for negated boolean variables.\n\n```sh\nnode example.js --no-foo\n{ _: [], foo: false }\n```\n\n_if set to `quux`:_\n\n```sh\nnode example.js --quuxfoo\n{ _: [], foo: false }\n```\n\n### populate --\n\n* default: `false`.\n* key: `populate--`\n\nShould unparsed flags be stored in `--` or `_`.\n\n_If disabled:_\n\n```sh\nnode example.js a -b -- x y\n{ _: [ 'a', 'x', 'y' ], b: true }\n```\n\n_If enabled:_\n\n```sh\nnode example.js a -b -- x y\n{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true }\n```\n\n### set placeholder key\n\n* default: `false`.\n* key: `set-placeholder-key`.\n\nShould a placeholder be added for keys not set via the corresponding CLI argument?\n\n_If disabled:_\n\n```sh\nnode example.js -a 1 -c 2\n{ _: [], a: 1, c: 2 }\n```\n\n_If enabled:_\n\n```sh\nnode example.js -a 1 -c 2\n{ _: [], a: 1, b: undefined, c: 2 }\n```\n\n### halt at non-option\n\n* default: `false`.\n* key: `halt-at-non-option`.\n\nShould parsing stop at the first text argument? This is similar to how e.g. `ssh` parses its command line.\n\n_If disabled:_\n\n```sh\nnode example.js -a run b -x y\n{ _: [ 'run', 'b', 'y' ], a: true, x: true }\n```\n\n_If enabled:_\n\n```sh\nnode example.js -a run b -x y\n{ _: [ 'run', 'b', '-x', 'y' ], a: true }\n```\n\n## Special Thanks\n\nThe yargs project evolves from optimist and minimist. It owes its\nexistence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \\o/\n\n## License\n\nISC\n", "readmeFilename": "README.md", "repository": { "url": "git+ssh://git@github.com/yargs/yargs-parser.git" }, "scripts": { "coverage": "nyc report --reporter=text-lcov | coveralls", "posttest": "standard", "release": "standard-version", "test": "nyc mocha test/*.js" }, "version": "11.1.1" }