Created
February 23, 2016 15:56
-
-
Save ajcrites/7952e72e2e7cca32ddcc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const Promise = require("bluebird"); | |
| const prompt = Promise.promisifyAll(require("prompt")); | |
| const inquirer = Promise.promisifyAll(require("inquirer")); | |
| const inquirerp = require("inquirer-promise"); | |
| const co = require("co"); | |
| prompt.start(); | |
| co(function* () { | |
| let result = yield prompt.getAsync(['name']); | |
| console.log("Hello,", result.name); | |
| const questions = [{type: "input", name: "name", message: "What's your name?"}]; | |
| // Cannot be immediately promisified since callback does not take an error argument | |
| // result = yield inquirer.promptAsync(questions); | |
| result = yield inquirerp.prompt(questions); | |
| console.log("Hello,", result.name); | |
| }).catch(console.error); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "blo", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "author": "", | |
| "license": "ISC", | |
| "dependencies": { | |
| "bluebird": "^3.3.1", | |
| "co": "^4.6.0", | |
| "inquirer": "^0.12.0", | |
| "inquirer-promise": "0.0.3", | |
| "prompt": "^1.0.0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment