98 lines
10 KiB
JSON
98 lines
10 KiB
JSON
|
{
|
||
|
"_args": [
|
||
|
[
|
||
|
{
|
||
|
"raw": "nopt@^3.0.1",
|
||
|
"scope": null,
|
||
|
"escapedName": "nopt",
|
||
|
"name": "nopt",
|
||
|
"rawSpec": "^3.0.1",
|
||
|
"spec": ">=3.0.1 <4.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/decompress-zip"
|
||
|
]
|
||
|
],
|
||
|
"_from": "nopt@>=3.0.1 <4.0.0",
|
||
|
"_id": "nopt@3.0.6",
|
||
|
"_inCache": true,
|
||
|
"_location": "/nopt",
|
||
|
"_nodeVersion": "4.2.1",
|
||
|
"_npmUser": {
|
||
|
"name": "othiym23",
|
||
|
"email": "ogd@aoaioxxysz.net"
|
||
|
},
|
||
|
"_npmVersion": "2.14.10",
|
||
|
"_phantomChildren": {},
|
||
|
"_requested": {
|
||
|
"raw": "nopt@^3.0.1",
|
||
|
"scope": null,
|
||
|
"escapedName": "nopt",
|
||
|
"name": "nopt",
|
||
|
"rawSpec": "^3.0.1",
|
||
|
"spec": ">=3.0.1 <4.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"_requiredBy": [
|
||
|
"/decompress-zip"
|
||
|
],
|
||
|
"_resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
|
||
|
"_shasum": "c6465dbf08abcd4db359317f79ac68a646b28ff9",
|
||
|
"_shrinkwrap": null,
|
||
|
"_spec": "nopt@^3.0.1",
|
||
|
"_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/decompress-zip",
|
||
|
"author": {
|
||
|
"name": "Isaac Z. Schlueter",
|
||
|
"email": "i@izs.me",
|
||
|
"url": "http://blog.izs.me/"
|
||
|
},
|
||
|
"bin": {
|
||
|
"nopt": "./bin/nopt.js"
|
||
|
},
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/npm/nopt/issues"
|
||
|
},
|
||
|
"dependencies": {
|
||
|
"abbrev": "1"
|
||
|
},
|
||
|
"description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",
|
||
|
"devDependencies": {
|
||
|
"tap": "^1.2.0"
|
||
|
},
|
||
|
"directories": {},
|
||
|
"dist": {
|
||
|
"shasum": "c6465dbf08abcd4db359317f79ac68a646b28ff9",
|
||
|
"tarball": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz"
|
||
|
},
|
||
|
"gitHead": "10a750c9bb99c1950160353459e733ac2aa18cb6",
|
||
|
"homepage": "https://github.com/npm/nopt#readme",
|
||
|
"license": "ISC",
|
||
|
"main": "lib/nopt.js",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "isaacs",
|
||
|
"email": "i@izs.me"
|
||
|
},
|
||
|
{
|
||
|
"name": "othiym23",
|
||
|
"email": "ogd@aoaioxxysz.net"
|
||
|
},
|
||
|
{
|
||
|
"name": "zkat",
|
||
|
"email": "kat@sykosomatic.org"
|
||
|
}
|
||
|
],
|
||
|
"name": "nopt",
|
||
|
"optionalDependencies": {},
|
||
|
"readme": "If you want to write an option parser, and have it be good, there are\ntwo ways to do it. The Right Way, and the Wrong Way.\n\nThe Wrong Way is to sit down and write an option parser. We've all done\nthat.\n\nThe Right Way is to write some complex configurable program with so many\noptions that you hit the limit of your frustration just trying to\nmanage them all, and defer it with duct-tape solutions until you see\nexactly to the core of the problem, and finally snap and write an\nawesome option parser.\n\nIf you want to write an option parser, don't write an option parser.\nWrite a package manager, or a source control system, or a service\nrestarter, or an operating system. You probably won't end up with a\ngood one of those, but if you don't give up, and you are relentless and\ndiligent enough in your procrastination, you may just end up with a very\nnice option parser.\n\n## USAGE\n\n // my-program.js\n var nopt = require(\"nopt\")\n , Stream = require(\"stream\").Stream\n , path = require(\"path\")\n , knownOpts = { \"foo\" : [String, null]\n , \"bar\" : [Stream, Number]\n , \"baz\" : path\n , \"bloo\" : [ \"big\", \"medium\", \"small\" ]\n , \"flag\" : Boolean\n , \"pick\" : Boolean\n , \"many1\" : [String, Array]\n , \"many2\" : [path]\n }\n , shortHands = { \"foofoo\" : [\"--foo\", \"Mr. Foo\"]\n , \"b7\" : [\"--bar\", \"7\"]\n , \"m\" : [\"--bloo\", \"medium\"]\n , \"p\" : [\"--pick\"]\n , \"f\" : [\"--flag\"]\n }\n // everything is optional.\n // knownOpts and shorthands default to {}\n // arg list defaults to process.argv\n // slice defaults to 2\n , parsed = nopt(knownOpts, shortHands, process.argv, 2)\n console.log(parsed)\n\nThis would give you support for any of the following:\n\n```bash\n$ node my-program.js --foo \"blerp\" --no-flag\n{ \"foo\" : \"blerp\", \"flag\" : false }\n\n$ node my-program.js ---bar 7 --foo \"Mr. Hand\" --flag\n{ bar: 7, foo: \"Mr. Hand\", flag: true }\n\n$ node my-program.js --foo \"blerp\" -f -----p\n{ foo: \"blerp\", flag: true, pick: true }\n\n$ node my-program.js -fp --foofoo\n{ foo: \"Mr. Foo\", flag: true, pick: true }\n\n$ node my-program.js --foofoo -- -fp # -- stops the flag parsing.\n{ foo: \"Mr. Foo\", argv: { remain: [\"-fp\"] } }\n\n$ node my-program.js --blatzk -fp # unknown opts are ok.\n{ blatzk: true, flag: true, pick: true }\n\n$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value\n{ blatzk: 1000, flag: true, pick: true }\n\n$ node my-program.js --no-blatzk -fp # unless they start with \"no-\"\n{ blatzk: false, flag: true, pick: true }\n\n$ node my-program.js --baz b/a/z # known paths are resolved.\n{ baz: \"/Users/isaacs/b/a/z\" }\n\n# if Array is one of the types, then it can take many\n# values, and will always be an array. The other types provided\n# specify what types are allowed in the list.\n\n$ node my-program.js --many1 5 --many1 null --many1 foo\n{ many1: [\"5\", \"null\", \"foo\"] }\n\n$ node my-program.js --many2 foo --many2 bar\n{ many2: [\"/path/to/foo\", \"path/to/bar\"] }\n```\n\nRead the tests at the bottom of `lib/nopt.js` for more examples of\nwhat this puppy can do.\n\n## Types\n\nThe following types are supported, and defined on `nopt.typeDefs`\n\n* String: A normal string. No parsing is done.\n* path: A file system path. Gets resolved against cwd if not absolute.\n* url: A url. If it doesn't parse, it isn't accepted.\n* Number: Must be numeric.\n* Date: Must parse as a date. If it does, and `Date` is one of the options,\n then it will return a Date object, not a string.\n* Boolean: Must be either `true` or `false`. If an option is a boolean,\n then it does not need a value, and its presence will imply `true` as\n the value. To negate boolean
|
||
|
"readmeFilename": "README.md",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git+https://github.com/npm/nopt.git"
|
||
|
},
|
||
|
"scripts": {
|
||
|
"test": "tap test/*.js"
|
||
|
},
|
||
|
"version": "3.0.6"
|
||
|
}
|