{"_id":"@cac/option-choices","_rev":"2-a58d985775a43d6ea48d4b04f7acbdae","name":"@cac/option-choices","description":"Mark an option as required for specific command.","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@cac/option-choices","version":"2.0.0","description":"Mark an option as required for specific command.","repository":{"url":"egoist/@cac/option-choices","type":"git"},"main":"index.js","files":["index.js"],"scripts":{"test":"npm run lint && ava","lint":"xo"},"author":{"name":"egoist","email":"0x142857@gmail.com"},"license":"MIT","keywords":["cac","cli","arguments","flags","plugin"],"publishConfig":{"access":"public"},"devDependencies":{"ava":"^0.22.0","cac":"^4.2.3","eslint-config-rem":"^3.0.0","execa":"^0.8.0","xo":"^0.18.0"},"xo":{"extends":"rem/prettier"},"ava":{"files":["test/test.js"]},"gitHead":"657c2acefbf14c81db1e3332456f0f431ac366dc","_id":"@cac/option-choices@2.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"rem","email":"0x142857@gmail.com"},"dist":{"integrity":"sha512-VrXuO/wa+GlZNdYJdAaULFuUR3XhgEBcZL7b+dtM5JrBlmcnxQvuYtM6U/C9zbjV77iunARDD2HsJwjhPYRMxQ==","shasum":"e4e8069b6f0ed27b64f6c8436ed6795dcdb8e7f4","tarball":"https://registry.npmjs.org/@cac/option-choices/-/option-choices-2.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRqrqGfeibz9TZWPnEQ+LwkLT5CBt9lmRt41HZnqA+8QIgL6QbLTKuAItE8IjC+LXcv4Toffkth8etECXQhLcbSK4="}]},"maintainers":[{"name":"rem","email":"0x142857@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/option-choices-2.0.0.tgz_1512481721023_0.7687733366619796"}},"2.0.1":{"name":"@cac/option-choices","version":"2.0.1","description":"Mark an option as required for specific command.","repository":{"url":"egoist/@cac/option-choices","type":"git"},"main":"index.js","files":["index.js"],"scripts":{"test":"npm run lint && ava","lint":"xo"},"author":{"name":"egoist","email":"0x142857@gmail.com"},"license":"MIT","keywords":["cac","cli","arguments","flags","plugin"],"publishConfig":{"access":"public"},"devDependencies":{"ava":"^0.22.0","cac":"^4.2.3","eslint-config-rem":"^3.0.0","execa":"^0.8.0","xo":"^0.18.0"},"xo":{"extends":"rem/prettier"},"ava":{"files":["test/test.js"]},"gitHead":"18b6502e422a838cac79c3a855a1d8e14f372772","_id":"@cac/option-choices@2.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"rem","email":"0x142857@gmail.com"},"dist":{"integrity":"sha512-4iUlxiBcrvQ71VrNQsVxkrqv8Wlkh00/nchmhYysIQ0Kyx9BLlI53mNdgpNqVpVxrq2Sf097TEiXrkRStV4wMg==","shasum":"7c946471f1f37a12cd410dc4e485ebf8d271693a","tarball":"https://registry.npmjs.org/@cac/option-choices/-/option-choices-2.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHEdA08zcMAqwMFidy5YjELBzCRb/plOwrb0bzQc+VyVAiBavw1bQ1Ehu0uVCwDzq9K5UF1Lt+X8LIgoJ+iCqf//Lw=="}]},"maintainers":[{"name":"kchan","email":"kchanzen@gmail.com"},{"name":"rem","email":"0x142857@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/option-choices-2.0.1.tgz_1512482251685_0.9562412921804935"}}},"readme":"\n# @cac/option-choices\n\n[![NPM version](https://img.shields.io/npm/v/@cac/option-choices.svg?style=flat)](https://npmjs.com/package/@cac/option-choices) [![NPM downloads](https://img.shields.io/npm/dm/@cac/option-choices.svg?style=flat)](https://npmjs.com/package/@cac/option-choices) [![CircleCI](https://circleci.com/gh/cacjs/option-choices/tree/master.svg?style=shield)](https://circleci.com/gh/cacjs/option-choices/tree/master)  [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate) [![chat](https://img.shields.io/badge/chat-on%20discord-7289DA.svg?style=flat)](https://chat.egoist.moe)\n\nLimit valid values for CLI flag to a predefined set of choices, given as an array.\n\n## Install\n\n```bash\nyarn add @cac/option-choices\n```\n\n## Usage\n\nYour `cli.js`:\n\n```js\nconst cac = require('cac')\nconst optionChoices = require('@cac/option-choices')\n\nconst cli = cac()\n\n// Apply this plugin\ncli.use(optionChoices())\n\ncli.command('init', 'init command', () => console.log('init something'))\n  .option('fruit', {\n    choices: ['apple', 'banana'],\n    desc: 'Choose a fruit'\n  })\n\ncli.parse()\n```\n\nRun `node cli.js --fruit peach` and it will throw:\n\n<img src=\"https://i.loli.net/2017/12/05/5a26a5a983350.png\" width=\"500\" alt=\"preview\">\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n\n## Author\n\n**@cac/option-choices** © [EGOIST](https://github.com/egoist), Released under the [MIT](./LICENSE) License.<br>\nAuthored and maintained by EGOIST with help from contributors ([list](https://github.com/egoist/@cac/option-choices/contributors)).\n\n> [github.com/egoist](https://github.com/egoist) · GitHub [@EGOIST](https://github.com/egoist) · Twitter [@_egoistlily](https://twitter.com/_egoistlily)\n","maintainers":[{"name":"kchan","email":"kchanzen@gmail.com"},{"name":"rem","email":"0x142857@gmail.com"}],"time":{"modified":"2022-04-04T21:28:24.297Z","created":"2017-12-05T13:48:41.107Z","2.0.0":"2017-12-05T13:48:41.107Z","2.0.1":"2017-12-05T13:57:31.764Z"},"keywords":["cac","cli","arguments","flags","plugin"],"repository":{"url":"egoist/@cac/option-choices","type":"git"},"author":{"name":"egoist","email":"0x142857@gmail.com"},"license":"MIT","readmeFilename":"README.md"}