package.json 6.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. {
  2. "_args": [
  3. [
  4. "noptify@~0.0.3",
  5. "/repo/combiclub.com/wwwroot/themes/combi/_grunt/node_modules/tiny-lr-fork"
  6. ]
  7. ],
  8. "_from": "noptify@>=0.0.3 <0.1.0",
  9. "_id": "noptify@0.0.3",
  10. "_inCache": true,
  11. "_location": "/noptify",
  12. "_npmUser": {
  13. "email": "daniel.mickael@gmail.com",
  14. "name": "mklabs"
  15. },
  16. "_npmVersion": "1.2.0",
  17. "_phantomChildren": {
  18. "abbrev": "1.0.7"
  19. },
  20. "_requested": {
  21. "name": "noptify",
  22. "raw": "noptify@~0.0.3",
  23. "rawSpec": "~0.0.3",
  24. "scope": null,
  25. "spec": ">=0.0.3 <0.1.0",
  26. "type": "range"
  27. },
  28. "_requiredBy": [
  29. "/tiny-lr-fork"
  30. ],
  31. "_resolved": "https://registry.npmjs.org/noptify/-/noptify-0.0.3.tgz",
  32. "_shasum": "58f654a73d9753df0c51d9686dc92104a67f4bbb",
  33. "_shrinkwrap": null,
  34. "_spec": "noptify@~0.0.3",
  35. "_where": "/repo/combiclub.com/wwwroot/themes/combi/_grunt/node_modules/tiny-lr-fork",
  36. "author": {
  37. "name": "mklabs"
  38. },
  39. "dependencies": {
  40. "nopt": "~2.0.0"
  41. },
  42. "description": "nopt wrapper with commander-like API",
  43. "devDependencies": {
  44. "mocha": "~1.8.1"
  45. },
  46. "directories": {},
  47. "dist": {
  48. "shasum": "58f654a73d9753df0c51d9686dc92104a67f4bbb",
  49. "tarball": "http://registry.npmjs.org/noptify/-/noptify-0.0.3.tgz"
  50. },
  51. "installable": true,
  52. "maintainers": [
  53. {
  54. "name": "mklabs",
  55. "email": "daniel.mickael@gmail.com"
  56. }
  57. ],
  58. "name": "noptify",
  59. "optionalDependencies": {},
  60. "readme": "### noptify\n\nnoptify is a little wrapper around `nopt` module adding a more expressive,\ncommander-like, API and few helpers.\n\nExamples\n\n var program = noptify(process.argv, { program: 'name' })\n .version('0.0.1')\n .option('port', '-p', 'Port to listen on (default: 35729)', Number)\n .option('pid', 'Path to the generated PID file', String)\n\n var opts = program.parse();\n\nReturns an instance of `Noptify`\n\n### Noptify\n\nNoptify provides the API to parse out option, shorthands and generate the\nproper generic help output.\n\n- args - The Array of arguments to parse (default: `process.argv`);\n- options - An hash of options with the following properties\n - program - The program name to use in usage output\n\nEvery noptify instance is created with two options, `-h, --help` and `-v,\n--version`.\n\n### Noptify#parse\n\nParse the provided options and shorthands, pass them through `nopt` and\nreturn the result.\n\nWhen `opts.help` is set, the help output is displayed and `help`\nevent is emitted. The process exists with `0` status, the help output is\nautomatically displayed and the `help` event is emitted.\n\nExamples\n\n var program = noptify(['foo', '--help'])\n .on('help', function() {\n console.log('Examples');\n console.log('');\n console.log(' foo bar --baz > foo.txt');\n });\n\n var opts = program.parse();\n // ... Help output ...\n // ... Custom help output ...\n // ... Exit ...\n\n\n\n### Noptify#version\n\nDefine the program version.\n\n### Noptify#option\n\nDefine `name` option with optional shorthands, optional description and optional type.\n\n### Noptify#help\n\nSimply output to stdout the Usage and Help output.\n\n---\n\n*Mocha generated documentation*\n\n- [API](#api)\n- [Collectable](#collectable)\n- [Commandable](#commandable)\n - [Parses remaining arguments and route to the appropriate command](#commandable-parses-remaining-arguments-and-route-to-the-appropriate-command)\n\n<a name=\"\"></a>\n\n<a name=\"api\"></a>\n## API\nreturns an instanceof Noptify.\n\n```js\nassert.ok(noptify() instanceof noptify.Noptify);\n```\n\nis typically used like so.\n\n```js\nvar program = noptify(['node', 'file.js', '-d', '--dirname', './', '-p', '3000', 'app.js', 'base.js'])\n .option('debug', '-d', 'Enabled debug output', Boolean)\n .option('dirname', 'The path to the output directory')\n .option('port', '-p', 'The port you wish to listen on', Number)\n\n// opts => nopt result\nvar opts = program.parse();\n\nassert.deepEqual(opts, {\n port: 3000,\n debug: true,\n dirname: './',\n argv: {\n remain: ['app.js', 'base.js'],\n cooked: ['--debug', '--dirname', './', '--port', '3000', 'app.js', 'base.js'],\n original: ['-d', '--dirname', './', '-p', '3000', 'app.js', 'base.js']\n }\n});\n```\n\nallows definitiion of shorthands separately.\n\n```js\nvar opts = noptify(['node', 'file.js', '-lc'])\n .option('line-comment', 'Ouputs with debugging information', Boolean)\n .shorthand('lc', '--line-comment')\n .parse();\n\nassert.equal(opts['line-comment'], true);\n```\n\n<a name=\"collectable\"></a>\n## Collectable\nprovides the helper method to read from stdin.\n\n```js\nvar program = noptify();\nassert.ok(typeof program.stdin === 'function', 'stdin defined');\n```\n\nis invoked only when .parse() is called.\n\n```js\nvar program = noptify(['', '']);\nvar str = 'testing out stdin helper';\nprogram.stdin(function(err, res) {\n assert.equal(res, str);\n done();\n});\n\nprogram.parse();\n\nprocess.nextTick(function() {\n process.stdin.emit('data', str);\n process.stdin.emit('end');\n});\n```\n\n<a name=\"commandable\"></a>\n## Commandable\nprovides the .command() utility.\n\n```js\nassert.ok(typeof noptify().command === 'function');\n```\n\n<a name=\"commandable-parses-remaining-arguments-and-route-to-the-appropriate-command\"></a>\n## Parses remaining arguments and route to the appropriate command\ncan be a simple function.\n\n```js\nvar program = noptify(['', '', 'init', '--debug', 'foo']).option('debug', 'an option');\n\nprogram.command('init', function(args, opts) {\n // args ==> sliced args at command position\n // opts ==> nopt parsed object\n assert.deepEqual(args, ['--debug', 'foo']);\n assert.equal(opts.debug, true);\n assert.equal(opts.argv.remain[0], 'foo');\n done();\n});\n\nprogram.parse();\n```\n\nor another program, an Noptify instance.\n\n```js\nvar args = ['', '', 'init', '--debug', 'myapp', 'foo'];\n\nvar init = noptify(args)\n .option('debug', 'Debug output')\n .command('myapp', done.bind(null, null));\n\nnoptify(args).command('init', init).parse();\n```\n\n",
  61. "readmeFilename": "readme.md",
  62. "repository": {
  63. "type": "git",
  64. "url": "git://github.com/mklabs/noptify.git"
  65. },
  66. "scripts": {
  67. "test": "mocha --reporter spec"
  68. },
  69. "version": "0.0.3"
  70. }