strapi/packages/generators/generate/custom-prompt.js
2021-08-27 16:01:16 +02:00

28 lines
578 B
JavaScript

'use strict';
const inquirer = require('inquirer');
const getAttributes = async (attributes = []) => {
const prompts = [
{
type: 'input',
name: 'inputValue',
message: 'Enter some input: ',
},
{
type: 'confirm',
name: 'again',
message: 'Enter another input? ',
default: true,
},
];
// eslint-disable-next-line
const { again, ...answers } = await inquirer.prompt(prompts);
const newInputs = [...attributes, answers];
return again ? getAttributes(newInputs) : newInputs;
};
module.exports = getAttributes;