111 lines
17 KiB
JSON
111 lines
17 KiB
JSON
|
{
|
||
|
"_args": [
|
||
|
[
|
||
|
{
|
||
|
"raw": "optionator@^0.8.1",
|
||
|
"scope": null,
|
||
|
"escapedName": "optionator",
|
||
|
"name": "optionator",
|
||
|
"rawSpec": "^0.8.1",
|
||
|
"spec": ">=0.8.1 <0.9.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/escodegen"
|
||
|
]
|
||
|
],
|
||
|
"_from": "optionator@>=0.8.1 <0.9.0",
|
||
|
"_id": "optionator@0.8.2",
|
||
|
"_inCache": true,
|
||
|
"_location": "/optionator",
|
||
|
"_nodeVersion": "6.6.0",
|
||
|
"_npmOperationalInternal": {
|
||
|
"host": "packages-12-west.internal.npmjs.com",
|
||
|
"tmp": "tmp/optionator-0.8.2.tgz_1474487142656_0.7901301246602088"
|
||
|
},
|
||
|
"_npmUser": {
|
||
|
"name": "gkz",
|
||
|
"email": "z@georgezahariev.com"
|
||
|
},
|
||
|
"_npmVersion": "3.9.0",
|
||
|
"_phantomChildren": {},
|
||
|
"_requested": {
|
||
|
"raw": "optionator@^0.8.1",
|
||
|
"scope": null,
|
||
|
"escapedName": "optionator",
|
||
|
"name": "optionator",
|
||
|
"rawSpec": "^0.8.1",
|
||
|
"spec": ">=0.8.1 <0.9.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"_requiredBy": [
|
||
|
"/escodegen"
|
||
|
],
|
||
|
"_resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
|
||
|
"_shasum": "364c5e409d3f4d6301d6c0b4c05bba50180aeb64",
|
||
|
"_shrinkwrap": null,
|
||
|
"_spec": "optionator@^0.8.1",
|
||
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/escodegen",
|
||
|
"author": {
|
||
|
"name": "George Zahariev",
|
||
|
"email": "z@georgezahariev.com"
|
||
|
},
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/gkz/optionator/issues"
|
||
|
},
|
||
|
"dependencies": {
|
||
|
"deep-is": "~0.1.3",
|
||
|
"fast-levenshtein": "~2.0.4",
|
||
|
"levn": "~0.3.0",
|
||
|
"prelude-ls": "~1.1.2",
|
||
|
"type-check": "~0.3.2",
|
||
|
"wordwrap": "~1.0.0"
|
||
|
},
|
||
|
"description": "option parsing and help generation",
|
||
|
"devDependencies": {
|
||
|
"istanbul": "~0.4.1",
|
||
|
"livescript": "~1.5.0",
|
||
|
"mocha": "~3.0.2"
|
||
|
},
|
||
|
"directories": {},
|
||
|
"dist": {
|
||
|
"shasum": "364c5e409d3f4d6301d6c0b4c05bba50180aeb64",
|
||
|
"tarball": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz"
|
||
|
},
|
||
|
"engines": {
|
||
|
"node": ">= 0.8.0"
|
||
|
},
|
||
|
"files": [
|
||
|
"lib",
|
||
|
"README.md",
|
||
|
"LICENSE"
|
||
|
],
|
||
|
"gitHead": "191de235d5afa47ebb655fc0efbc2b616263d81b",
|
||
|
"homepage": "https://github.com/gkz/optionator",
|
||
|
"keywords": [
|
||
|
"options",
|
||
|
"flags",
|
||
|
"option parsing",
|
||
|
"cli"
|
||
|
],
|
||
|
"license": "MIT",
|
||
|
"main": "./lib/",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "gkz",
|
||
|
"email": "z@georgezahariev.com"
|
||
|
}
|
||
|
],
|
||
|
"name": "optionator",
|
||
|
"optionalDependencies": {},
|
||
|
"readme": "# Optionator\n<a name=\"optionator\" />\n\nOptionator is a JavaScript option parsing and help generation library used by [eslint](http://eslint.org), [Grasp](http://graspjs.com), [LiveScript](http://livescript.net), [esmangle](https://github.com/estools/esmangle), [escodegen](https://github.com/estools/escodegen), and [many more](https://www.npmjs.com/browse/depended/optionator).\n\nFor an online demo, check out the [Grasp online demo](http://www.graspjs.com/#demo).\n\n[About](#about) · [Usage](#usage) · [Settings Format](#settings-format) · [Argument Format](#argument-format)\n\n## Why?\nThe problem with other option parsers, such as `yargs` or `minimist`, is they just accept all input, valid or not.\nWith Optionator, if you mistype an option, it will give you an error (with a suggestion for what you meant).\nIf you give the wrong type of argument for an option, it will give you an error rather than supplying the wrong input to your application.\n\n $ cmd --halp\n Invalid option '--halp' - perhaps you meant '--help'?\n\n $ cmd --count str\n Invalid value for option 'count' - expected type Int, received value: str.\n\nOther helpful features include reformatting the help text based on the size of the console, so that it fits even if the console is narrow, and accepting not just an array (eg. process.argv), but a string or object as well, making things like testing much easier.\n\n## About\nOptionator uses [type-check](https://github.com/gkz/type-check) and [levn](https://github.com/gkz/levn) behind the scenes to cast and verify input according the specified types.\n\nMIT license. Version 0.8.2\n\n npm install optionator\n\nFor updates on Optionator, [follow me on twitter](https://twitter.com/gkzahariev).\n\n## Usage\n`require('optionator');` returns a function. It has one property, `VERSION`, the current version of the library as a string. This function is called with an object specifying your options and other information, see the [settings format section](#settings-format). This in turn returns an object with three properties, `parse`, `parseArgv`, `generateHelp`, and `generateHelpForOption`, which are all functions.\n\n```js\nvar optionator = require('optionator')({\n prepend: 'Usage: cmd [options]',\n append: 'Version 1.0.0',\n options: [{\n option: 'help',\n alias: 'h',\n type: 'Boolean',\n description: 'displays help'\n }, {\n option: 'count',\n alias: 'c',\n type: 'Int',\n description: 'number of things',\n example: 'cmd --count 2'\n }]\n});\n\nvar options = optionator.parseArgv(process.argv);\nif (options.help) {\n console.log(optionator.generateHelp());\n}\n...\n```\n\n### parse(input, parseOptions)\n`parse` processes the `input` according to your settings, and returns an object with the results.\n\n##### arguments\n* input - `[String] | Object | String` - the input you wish to parse\n* parseOptions - `{slice: Int}` - all options optional\n - `slice` specifies how much to slice away from the beginning if the input is an array or string - by default `0` for string, `2` for array (works with `process.argv`)\n\n##### returns\n`Object` - the parsed options, each key is a camelCase version of the option name (specified in dash-case), and each value is the processed value for that option. Positional values are in an array under the `_` key.\n\n##### example\n```js\nparse(['node', 't.js', '--count', '2', 'positional']); // {count: 2, _: ['positional']}\nparse('--count 2 positional'); // {count: 2, _: ['positional']}\nparse({count: 2, _:['positional']}); // {count: 2, _: ['positional']}\n```\n\n### parseArgv(input)\n`parseArgv` works exactly like `parse`, but only for array input and it slices off the first two elements.\n\n##### arguments\n* input - `[String]` - the input you wish to parse\n\n##### returns\nSee \"returns\" section in \"parse\"\n\n##### example\n```js\nparseArgv(process.argv);\n```\n\n### generateHelp(helpOptions)\n`generateHelp`
|
||
|
"readmeFilename": "README.md",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git://github.com/gkz/optionator.git"
|
||
|
},
|
||
|
"scripts": {
|
||
|
"test": "make test"
|
||
|
},
|
||
|
"version": "0.8.2"
|
||
|
}
|