Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const inquirer = require('inquirer')
  2.  
  3. let opciones = [
  4.     {
  5.         name:'nombre',
  6.         type: 'input',
  7.         message: 'Ingresá tu nombre',
  8.     },
  9.     {
  10.         name:'telefono',
  11.         type:'input',
  12.         message: 'Ingresá tu número de teléfono',
  13.     },
  14.     {
  15.         name:'gusto',
  16.         type: 'rawlist',
  17.         message: 'Elegí el gusto de la pizza',
  18.         choices:['Muzarella', 'Jamon y Morron', 'Calabresa', '4 Quesos']
  19.     },
  20.     {
  21.         name:'tamano',
  22.         type:'list',
  23.         message:'seleccioná el tamaño',
  24.         choices:['Individual','Chica','Mediana','Grande'],
  25.     },
  26.     {
  27.         name:'bebida',
  28.         type:'list',
  29.         message:'Elegí tu bebida',
  30.         choices:['Coca-Cola','Sprite','Fanta','Agua'],
  31.     },
  32.     {
  33.         name:'empanadas',
  34.         type:'confirm',
  35.         message:'Queres empanadas?',
  36.         default:'false',
  37.     },
  38.     {
  39.         name:'gustos-empanadas',
  40.         type:'checkbox',
  41.         message:'Que sabores?',
  42.         choices:['J&Q','Carne','Pollo','Humita','Roquefort','Verdura'],
  43.         when: function (answers){
  44.             return answers.empanadas
  45.         },
  46.     },
  47.     {
  48.         name:'delivery',
  49.         type:'confirm',
  50.         message:'La orden es para llevar?',
  51.         default:'false',
  52.     },
  53.     {
  54.         name:'direccion',
  55.         type:'input',
  56.         message:'ingresá tu dirección',
  57.         when: function (answers){
  58.             return answers.delivery
  59.         },
  60.     }
  61. ]
  62.  
  63. inquirer.prompt(opciones)
  64. .then(answers => {
  65.     if(answers.delivery == true){
  66.         console.log('Tu orden es una pizza '+ answers.tamano + ' de ' + answers.gusto + ' con ' + answers.bebida)}
  67.     else console.log('debe realizar la orden en persona')
  68. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement