inquirer-promise

Promise-based shortcuts for inquirer


License
MIT
Install
npm install inquirer-promise@1.0.0

Documentation

inquirer-shortcuts

Wraps the inquirer package and adds shortcuts for all question types. This is handy if you only have one prompt or if you use async/await.

prompt

This method remains unchanged from the inquirer package.

inquirer = require("inquirer-shortcuts");

inquirer.prompt([{type: "input",
                  name: "animal",
                  message: "Favorite animal?",
                  default: "wapiti"}])
  .then(results => console.log(results.animal));

question

Ask one question.

inquirer.question({type: "input",
                   message: "Favorite animal?",
                   default: "wapiti"})
  .then(animal => console.log(animal));

input

inquirer.input("Favorite animal?", {default: "wapiti"})
  .then(animal => console.log(animal));

confirm

inquirer.confirm("Is the wapiti your favorite animal?")
  .then(answer => console.log(answer));

list

inquirer.list("Favorite animal?", ["cat", "dog", "wapiti"])
  .then(animal => console.log(animal));

rawlist

inquirer.rawlist("Favorite animal?", ["cat", "dog", "wapiti"])
  .then(animal => console.log(animal));

expand

inquirer.expand("Favorite animal?",
                [{key: "c", name: "cat"}
                 {key: "d", name: "dog"}
                 {key: "w", name: "wapiti"}])
  .then(animal => console.log(animal));

checkbox

inquirer.checkbox("Favorite animals?", ["cat", "dog", "wapiti"])
  .then(animals => console.log(animals));

password

inquirer.password("Enter password.")
  .then(password => console.log("Don't print passwords!"));