Skip to content

Instantly share code, notes, and snippets.

@jebeck
Created February 6, 2017 00:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jebeck/e72b8f43d0e35258d8f38aaf0e22ce63 to your computer and use it in GitHub Desktop.
Save jebeck/e72b8f43d0e35258d8f38aaf0e22ce63 to your computer and use it in GitHub Desktop.
very simple Inquirer.js example
// 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