-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
53 lines (53 loc) · 12 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
"name": "inquirer",
"version": "0.6.0",
"description": "A collection of common interactive command line user interfaces.",
"main": "lib/inquirer.js",
"scripts": {
"test": "grunt --verbose"
},
"repository": {
"type": "git",
"url": "git://github.com/SBoudrias/Inquirer.js.git"
},
"keywords": [
"command",
"prompt",
"stdin",
"cli"
],
"author": {
"name": "Simon Boudrias",
"email": "admin@simonboudrias.com"
},
"license": "MIT",
"dependencies": {
"chalk": "^0.5.0",
"cli-color": "~0.3.2",
"lodash": "~2.4.1",
"mute-stream": "0.0.4",
"readline2": "~0.1.0",
"rx": "^2.2.27",
"through": "~2.3.4"
},
"devDependencies": {
"chai": "~1.9.0",
"cmdify": "0.0.4",
"grunt": "~0.4.1",
"grunt-cli": "~0.1.8",
"grunt-contrib-jshint": "~0.10.0",
"grunt-mocha-test": "~0.10.2",
"grunt-release": "~0.7.0",
"mocha": "~1.18.2",
"mockery": "~1.4.0",
"sinon": "~1.9.1"
},
"readme": "Inquirer.js\n===========\n\n[![npm](https://badge.fury.io/js/inquirer.svg)](http://badge.fury.io/js/inquirer) [![tests](https://travis-ci.org/SBoudrias/Inquirer.js.svg?branch=master)](http://travis-ci.org/SBoudrias/Inquirer.js) [![dependencies](https://david-dm.org/SBoudrias/Inquirer.js.svg?theme=shields.io)](https://david-dm.org/SBoudrias/Inquirer.js)\n\nA collection of common interactive command line user interfaces.\n\n\n## Goal and philosophy\n\nWe strive at providing easily embeddable and beautiful command line interface for Node.js; some hope in becoming the CLI Xanadu.\n\n_**Inquirer**_ should ease the process of asking end user **questions**, **parsing**, **validating** answers, managing **hierarchical prompts** and providing **error feedback**.\n\n_**Inquirer**_ provide the user interface, and the inquiry session flow. If you're searching for a full blown command line program utility, then check out [Commander.js](https://github.com/visionmedia/commander.js) (inspired by) or [cli-color](https://github.com/medikoo/cli-color) (used internally).\n\n\n## Documentation\n\n### Installation\n\n``` shell\nnpm install inquirer\n```\n\n```javascript\nvar inquirer = require(\"inquirer\");\ninquirer.prompt([/* Pass your questions in here */], function( answers ) {\n\t// Use user feedback for... whatever!!\n});\n```\n\n\n### Examples (Run it and see it)\nCheckout the `examples/` folder for code and interface examples.\n\n``` shell\nnode examples/pizza.js\nnode examples/checkbox.js\n# etc...\n```\n\n\n### Methods\n\n`inquirer.prompt( questions, callback )`\n\nLaunch the prompt interface (inquiry session)\n\n- **questions** (Array) containing [Question Object](#question) (using the [reactive interface](#reactive-interface), you can also pass a `Rx.Observable` instance)\n- **callback** (Function) first parameter is the [Answers Object](#answers)\n\n\n### Objects\n\n#### Question\nA question object is a `hash` containing question related values:\n\n- **type**: (String) Type of the prompt. Defaults: `input` - Possible values: `input`, `confirm`,\n`list`, `rawlist`\n- **name**: (String) The name to use when storing the answer in the anwers hash.\n- **message**: (String) The question to print.\n- **default**: (String|Number|Array|Function) Default value(s) to use if nothing is entered, or a function that returns the default value(s). If defined as a function, the first parameter will be the current inquirer session answers.\n- **choices**: (Array|Function) Choices array or a function returning a choices array. If defined as a function, the first parameter will be the current inquirer session answers. \nArray values can be simple `strings`, or `objects` containing a `name` (to display) and a `value` properties (to save in the answers hash). Values can also be [a `Separator`](#separator).\n- **validate**: (Function) Receive the user input and should return `true` if the value is valid, and an error message (`String`) otherwise. If `false` is returned, a default error message is provided.\n- **filter**: (Function) Receive the user input and return the filtered value to be used inside the program. The value returned will be added to the _Answers_ hash.\n- **when**: (Function) Receive the current user answers hash and should return `true` or `false` depending on whether or not this question should be asked.\n\n`default`(if defined as a function), `validate`, `filter` and `when` functions can be asynchronously using `this.async()`. You just have to pass the value you'd normally return to the callback option.\n\n``` javascript\n{\n validate: function(input) {\n\n // Declare function as asynchronous, and save the done callback\n var done = this.async();\n\n // Do async stuff\n setTimeout(function() {\n if (typeof input !== \"number\") {\n // Pass the return value in the done callback\n done(\"You need to provide a number\");\n return;\n }\n // Pass the return value in the done callback\n done(true);\n }, 3000);\n }\n}\n```\n\n### Answers\nA key/value hash containing the client answers in each prompt.\n\n- **Key** The `name` property of the _question_ object\n- **Value** (Depends on the prompt)\n - `confirm`: (Boolean)\n - `input` : User input (filtered if `filter` is defined) (String)\n - `rawlist`, `list` : Selected choice value (or name if no value specified) (String)\n\n### Separator\nA separator can be added to any `choices` array:\n\n```\n// In the question object\nchoices: [ \"Choice A\", new inquirer.Separator(), \"choice B\" ]\n\n// Which'll be displayed this way\n[?] What do you want to do?\n > Order a pizza\n Make a reservation\n --------\n Ask opening hours\n Talk to the receptionnist\n```\n\nThe constructor takes a facultative `String` value that'll be use as the separator. If omitted, the separator will be `--------`.\n\nSeparator instances have a property `type` equal to `separator`. This should allow tools façading Inquirer interface from detecting separator types in lists.\n\nPrompts type\n---------------------\n\n> **Note:**: _allowed options written inside square brackets (`[]`) are optional. Others are required._\n\n#### List - `{ type: \"list\" }`\n\nTake `type`, `name`, `message`, `choices`[, `default`, `filter`] properties. (Note that\ndefault must be the choice `index` in the array or a choice `value`)\n\n![List prompt](https://dl.dropboxusercontent.com/u/59696254/inquirer/list-prompt.png)\n\n---\n\n#### Raw List - `{ type: \"rawlist\" }`\n\nTake `type`, `name`, `message`, `choices`[, `default`, `filter`] properties. (Note that\ndefault must the choice `index` in the array)\n\n![Raw list prompt](https://i.cloudup.com/LcRGpXI0CX-3000x3000.png)\n\n---\n\n#### Expand - `{ type: \"expand\" }`\n\nTake `type`, `name`, `message`, `choices`[, `default`, `filter`] properties. (Note that\ndefault must be the choice `index` in the array)\n\nNote that the `choice` object will take an extra parameter called `key` for the `expand` prompt. This parameter must be a single (lowercased) character. The `h` option is added by the prompt and shouldn't be defined by the user.\n\nSee `examples/expand.js` for a running example.\n\n![Expand prompt closed](https://dl.dropboxusercontent.com/u/59696254/inquirer/expand-prompt-1.png)\n![Expand prompt expanded](https://dl.dropboxusercontent.com/u/59696254/inquirer/expand-prompt-2.png)\n\n---\n\n#### Checkbox - `{ type: \"checkbox\" }`\n\nTake `type`, `name`, `message`, `choices`[, `filter`, `validate`, `default`] properties. `default` is expected to be an Array of the checked choices value.\n\nChoices marked as `{ checked: true }` will be checked by default.\n\nChoices who're property `disabled` is truthy will be unselectable. If `disabled` is a string, then the string will be outputed next to the disabled choice, otherwise it'll default to `\"Disabled\"`. The `disabled` property can also be a synchronous function receiving the current answers as argument and returning a boolean or a string.\n\n![Checkbox prompt](https://dl.dropboxusercontent.com/u/59696254/inquirer/checkbox-prompt.png)\n\n---\n\n#### Confirm - `{ type: \"confirm\" }`\n\nTake `type`, `name`, `message`[, `default`] properties. `default` is expected to be a boolean if used.\n\n![Confirm prompt](https://dl.dropboxusercontent.com/u/59696254/inquirer/confirm-prompt.png)\n\n---\n\n#### Input - `{ type: \"input\" }`\n\nTake `type`, `name`, `message`[, `default`, `filter`, `validate`] properties.\n\n![Input prompt](https://dl.dropboxusercontent.com/u/59696254/inquirer/input-prompt.png)\n\n---\n\n#### Password - `{ type: \"password\" }`\n\nTake `type`, `name`, `message`[, `default`, `filter`, `validate`] properties.\n\n![Password prompt](https://dl.dropboxusercontent.com/u/59696254/inquirer/password-prompt.png)\n\n## User Interfaces and layouts\n\nAlong with the prompts, Inquirer offers some basic text UI.\n\n#### Bottom Bar - `inquirer.ui.BottomBar`\n\nThis UI present a fixed text at the bottom of a free text zone. This is useful to keep a message to the bottom of the screen while outputting command outputs on the higher section.\n\n```javascript\nvar ui = new inquirer.ui.BottomBar();\n\n// pipe a Stream to the log zone\noutputStream.pipe( ui.log );\n\n// Or simply write output\nui.log.write(\"something just happened.\");\nui.log.write(\"Almost over, standby!\");\n\n// During processing, update the bottom bar content to display a loader\n// or output a progress bar, etc\nui.updateBottomBar(\"new bottom bar content\");\n```\n\n#### Prompt - `inquirer.ui.Prompt`\n\nThis is UI layout used to run prompt. This layout is returned by `inquirer.prompt` and you should probably always use `inquirer.prompt` to interface with this UI.\n\n\n## Reactive interface\n\nInternally, Inquirer uses the [JS reactive extension](https://github.com/Reactive-Extensions/RxJS) to handle events and async flows.\n\nThis mean you can take advantage of this feature to provide more advanced flows. For example, you can dynamically add questions to be asked:\n\n```js\nvar prompts = Rx.Observable.create(function( obs ) {\n obs.onNext({ /* question... */ });\n setTimeout(function () {\n obs.onNext({ /* question... */ });\n obs.onCompleted();\n });\n});\n\ninquirer.prompt(prompts);\n```\n\nAnd using the `process` property, you have access to more fine grained callbacks:\n\n```js\ninquirer.prompts(prompts).process.subscribe(\n onEachAnswer,\n onError,\n onComplete\n);\n```\n\n## Support (OS Terminals)\n\nYou should expect mostly good support for the CLI below. This does not mean we won't\nlook at issues found on other command line - feel free to report any!\n\n- **Mac OS**:\n - Terminal.app\n - iTerm\n- **Windows**:\n - cmd.exe\n - Powershell\n - Cygwin\n- **Ubuntu**:\n - Terminal\n\n\n## News on the march (Release notes)\n\nPlease refer to the [Github releases section for the changelog](https://github.com/SBoudrias/Inquirer.js/releases)\n\n\n## Contributing\n\n**Style Guide** \nPlease brief yourself on [Idiomatic.js](https://github.com/rwldrn/idiomatic.js) style guide with two space indent \n\n**Unit test** \nUnit test are written in [Mocha](http://visionmedia.github.io/mocha/). Please add a unit test for every new feature or bug fix. `npm test` to run the test suite. \n\n**Documentation** \nAdd documentation for every API change. Feel free to send corrections\nor better docs! \n\n**Pull Requests** \nSend _fixes_ PR on the `master` branch. Any new features should be send on the `wip`branch.\n\nWe're looking to offer good support for multiple prompts and environments. If you want to\nhelp, we'd like to keep a list of testers for each terminal/OS so we can contact you and\nget feedback before release. Let us know if you want to be added to the list (just tweet\nto @vaxilart) or just add your name to [the wiki](https://github.com/SBoudrias/Inquirer.js/wiki/Testers)\n\n## License\n\nCopyright (c) 2012 Simon Boudrias (twitter: @vaxilart) \nLicensed under the MIT license.\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/SBoudrias/Inquirer.js/issues"
},
"homepage": "https://github.com/SBoudrias/Inquirer.js",
"_id": "inquirer@0.6.0",
"_from": "inquirer@^0.6.0"
}