Created
February 6, 2017 00:56
-
-
Save jebeck/e72b8f43d0e35258d8f38aaf0e22ce63 to your computer and use it in GitHub Desktop.
very simple Inquirer.js example
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
// run with `node simple.js` in node v4.x+ | |
// must have Inquirer installed (`npm install inquirer`) | |
const inquirer = require('inquirer'); | |
inquirer.prompt([{ | |
name: 'name', | |
type: 'input', | |
message: 'What\'s your name?', | |
}, { | |
name: 'iceCream', | |
type: 'list', | |
message: 'Which is your favorite of the following ice cream flavors?', | |
choices: ['green tea', 'poppyseed jam', 'chile', 'vanilla'], | |
default: 3, | |
}]).then((answers) => { | |
console.log(`\nHi ${answers.name}. I like ${answers.iceCream} ice cream too! 😋\n`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment