You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

65 lines
1.3 KiB

const inquirer = require("inquirer");
module.exports = inquirer
.prompt([
{
type: "checkbox",
message: "Select toppings",
name: "toppings",
choices: [
new inquirer.Separator(" = The Meats = "),
{
name: "Pepperoni",
},
{
name: "Ham",
},
{
name: "Ground Meat",
},
{
name: "Bacon",
},
new inquirer.Separator(" = The Cheeses = "),
{
name: "Mozzarella",
checked: true,
},
{
name: "Cheddar",
},
{
name: "Parmesan",
},
new inquirer.Separator(" = The usual ="),
{
name: "Mushroom",
},
{
name: "Tomato",
},
new inquirer.Separator(" = The extras = "),
{
name: "Pineapple",
},
{
name: "Olives",
disabled: "out of stock",
},
{
name: "Extra cheese",
},
],
validate(answer) {
if (answer.length < 1) {
return "You must choose at least one topping.";
}
return true;
},
},
])
.then((answers) => {
console.log(JSON.stringify(answers, null, " "));
return answers;
});