{"name":"opt-cli","version":"1.4.2","description":"Execute CLI Statements based upon Opt-In / Opt-Out Rules.","main":"lib/index.js","bin":{"opt":"bin/index.js"},"scripts":{"commit":"git-cz","update-contributors":"all-contributors generate","validate":"npm-run-all --parallel lint cover --sequential check-coverage","lint":"eslint .","cover":"nyc --all --reporter=lcov --reporter=text ava","test":"ava","check-coverage":"nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100","report-coverage":"cat ./coverage/lcov.info | node_modules/.bin/codecov","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"repository":{"type":"git","url":"git+https://github.com/ta2edchimp/opt-cli.git"},"keywords":["executer","cli","opt-in","opt-out"],"author":{"name":"Andreas Windt","email":"email@andreaswindt.com","url":"http://andreaswindt.com"},"license":"MIT","bugs":{"url":"https://github.com/ta2edchimp/opt-cli/issues"},"homepage":"https://github.com/ta2edchimp/opt-cli#readme","dependencies":{"cli":"0.11.2","lodash.clone":"4.3.2","manage-path":"2.0.0","spawn-command":"0.0.2-1"},"devDependencies":{"all-contributors-cli":"2.0.0-beta8","ava":"0.14.0","codecov":"1.0.1","commitizen":"2.8.0","cz-conventional-changelog":"1.1.5","eslint":"2.8.0","eslint-config-idiomatic":"2.0.0","eslint-config-ta2edchimp":"1.1.1","ghooks":"1.2.1","npm-run-all":"1.7.0","nyc":"6.4.0","proxyquire":"1.7.4","semantic-release":"4.3.5","validate-commit-msg":"2.6.1"},"config":{"ghooks":{"commit-msg":"validate-commit-msg","pre-commit":"npm run validate"},"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"nyc":{"include":["bin/**/*","lib/**/*"]},"gitHead":"39c60ed64194272e874183cf3e449c6112fc9772","_id":"opt-cli@1.4.2","_shasum":"1ed8b4070e857f6a4351cafb76a9661594fbc9ad","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.10.1","_npmUser":{"name":"ta2edchimp","email":"kontakt@andreaswindt.de"},"dist":{"shasum":"1ed8b4070e857f6a4351cafb76a9661594fbc9ad","tarball":"http://registry-npm.ywwl.com/opt-cli/download/opt-cli-1.4.2.tgz","integrity":"sha512-iai3ywGbmEr9HyUz19c6W/kDsVnxbG2nx/k0Hrmd8bMO2sw2/rQVjXcYl/VxeMdNR9gEUEhGpOeiyyUvxtHqBQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDJUVUJ6BUVeRnk+n8DPgqpaJut7cQKnjFk25QWmTUXXAIgAh9YNr9/Q4c5Bihc3wxo4R01V6+8Ao0FX/KOOpKEXrQ="}],"size":8453,"noattachment":false,"key":"/opt-cli/-/opt-cli-1.4.2.tgz"},"maintainers":[{"name":"ta2edchimp","email":"kontakt@andreaswindt.de"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/opt-cli-1.4.2.tgz_1461159556648_0.7101067514158785"},"directories":{},"readme":"# opt-cli\nExecute CLI Statements based upon opt-in / out-out Rules.\n\n[![version](https://img.shields.io/npm/v/opt-cli.svg?style=flat-square)](http://npm.im/opt-cli)\n[![Build Status](https://img.shields.io/travis/ta2edchimp/opt-cli/master.svg?style=flat-square)](https://travis-ci.org/ta2edchimp/opt-cli)\n[![Code Coverage](https://img.shields.io/codecov/c/github/ta2edchimp/opt-cli.svg?style=flat-square)](https://codecov.io/github/ta2edchimp/opt-cli)\n[![Dependencies status](https://img.shields.io/david/ta2edchimp/opt-cli.svg?style=flat-square)](https://david-dm.org/ta2edchimp/opt-cli#info=dependencies)\n\n[![MIT License](https://img.shields.io/npm/l/opt-cli.svg?style=flat-square)](http://opensource.org/licenses/MIT)\n[![downloads](https://img.shields.io/npm/dm/opt-cli.svg?style=flat-square)](http://npm-stat.com/charts.html?package=opt-cli&from=2016-03-20)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors)\n\n## Installation\n\nSimply install locally as a development dependency to your project's package:\n\n```\nnpm install --save-dev opt-cli\n```\n\n## Intended usage\nOpting in/out of a configured tasks, **best use case is for ghooks**.\n[This discussion](https://github.com/gtramontina/ghooks/issues/48#issuecomment-194002689) is the main motivation behind this module.\n\nYou can check out the [eslint-find-new-rules/package.json](https://github.com/kentcdodds/eslint-find-new-rules/blob/master/package.json#L67) for reference.\n\n### `opt --in`\n\n```JSON\n\"config\": {\n  \"ghooks\": {\n    \"pre-commit\": \"opt --in pre-commit --exec 'npm run validate'\"\n  }\n},\n```\n\nWhile `commit`ing, `npm run validate` **will not be executed** by default.\nHowever, one can **opt in by creating a `.opt-in` file in the root of the project, with the content `pre-commit`**\n\n#### `.opt-in`\n\nEach line in the `.opt-in` file, is the keyword used after the `opt --in` rule.\n\nSo for the above example, it's `pre-commit`\n\n```\ncat .opt-in\n# \"ghooks\": {\n#   \"pre-commit\": \"opt --in pre-commit --exec 'npm run validate'\"\n# }\npre-commit # the keyword used after the opt --in command\n```\n\n### `opt --out`\n\n`opt --out` works exactly, the opposite way of `opt --in`.\n\n```JSON\n\"config\": {\n  \"ghooks\": {\n    \"pre-commit\": \"opt --out pre-commit --exec 'npm run validate'\"\n  }\n},\n```\n\nIn this case, `npm run validate` **will be executed** before any changes can be `commit`ed.\nIn order to **opt out, you have to create a `.opt-out` file in the root of the project, with the content `pre-commit`**\n\n#### `.opt-out`\n\nSimilar to `.opt-in` file, each line in `.opt-out` file, is the keyword used after the `opt --out` rule.\n\nSo for the above example, it's `pre-commit`\n\n```\ncat .opt-out\n# \"ghooks\": {\n#   \"pre-commit\": \"opt --out pre-commit --exec 'npm run validate'\"\n# }\npre-commit # the keyword used after the opt --out command\n```\n\n* **don't forget to update `.gitignore` to ignore this file.**\n* `opt-in`, `opt-out` files can contain multiple rules\n* every line must contain only a single rule.\n* `#` can be used to comment any rule.\n\n## Use As Library\n\nYou may also include opt-cli as a library:\n\n```JavaScript\nvar opt = require( 'opt-cli' );\n```\n\nGiven the example setup from above, usage would be as follows:\n\n```JavaScript\nopt.testOptIn( 'pre-commit' ) === true\nopt.testOptOut( 'pre-push' ) === true\n```\n\nUsing `opt.getExplicitOpts()` you would receive:\n\n```JavaScript\n{\n  'pre-commit': true,\n  'pre-push': false\n}\n```\n\n## Advanced Usage\n\nRules to opt-into or opt-out of can also be specified using ...\n\n- ... an `in` or `out` array of a `package.json`'s `config.opt` field:\n\n```JSON\n\"config\": {\n  \"opt\": {\n    \"in\": [ \"pre-commit\" ],\n    \"out\": [ \"pre-push\" ]\n  }\n},\n```\n\n- ... the environment variables `OPT_IN` and `OPT_OUT`:\n\n```\n# Delimit multiple rules with \":\" on *nix / \";\" on Win\nexport OPT_IN=\"pre-commit\"\nexport OPT_OUT=\"pre-push\"\n```\n\n## Contributors\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n| [<img src=\"https://avatars3.githubusercontent.com/u/1500684?v=3\" width=\"100px;\"/><br /><sub>Kent C. Dodds</sub>](https://twitter.com/kentcdodds)<br />[💻](https://github.com/ta2edchimp/opt-cli/commits?author=kentcdodds) 👀 | [<img src=\"https://avatars2.githubusercontent.com/u/374635?v=3\" width=\"100px;\"/><br /><sub>Guilherme J. Tramontina</sub>](https://github.com/gtramontina)<br />[💻](https://github.com/ta2edchimp/opt-cli/commits?author=gtramontina) | [<img src=\"https://avatars1.githubusercontent.com/u/262436?v=3\" width=\"100px;\"/><br /><sub>Andreas Windt</sub>](https://twitter.com/ta2edchimp)<br />[💻](https://github.com/ta2edchimp/opt-cli/commits?author=ta2edchimp) [📖](https://github.com/ta2edchimp/opt-cli/commits?author=ta2edchimp) [⚠️](https://github.com/ta2edchimp/opt-cli/commits?author=ta2edchimp) | [<img src=\"https://avatars1.githubusercontent.com/u/949380?v=3\" width=\"100px;\"/><br /><sub>Sarbbottam Bandyopadhyay</sub>](https://twitter.com/sarbbottam)<br />[📖](https://github.com/ta2edchimp/opt-cli/commits?author=sarbbottam) | [<img src=\"https://avatars2.githubusercontent.com/u/22251956?v=4\" width=\"100px;\"/><br /><sub>Suhas Karanth</sub>](https://github.com/sudo-suhas)<br />[🐛](https://github.com/ta2edchimp/opt-cli/issues?q=author%3Asudo-suhas) [💻](https://github.com/ta2edchimp/opt-cli/commits?author=sudo-suhas) |\n| :---: | :---: | :---: | :---: | :---: |\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)).\n[Contributions of any kind welcome](CONTRIBUTING.md)!\n\nSpecial thanks to [@kentcdodds](https://github.com/kentcdodds) for encouraging to engage in oss, for the wonderful resources (check out the [Egghead videos!](https://egghead.io/series/how-to-write-an-open-source-javascript-library)) and — together with [gtramontina](https://github.com/gtramontina) — for coming up with [the original idea to this module](https://github.com/gtramontina/ghooks/issues/48#issuecomment-194002689)!\n","publish_time":1461159557590,"_cnpm_publish_time":1461159557590,"dist-tags":{"latest":"1.6.0"}}