UNPKG

@enplug/scripts

Version:
19 lines (15 loc) 470 B
const inquirer = require('inquirer'); /** * If target is not defined, asks user to select one from the list. * @returns {Promise<string>} */ function promptForTarget(target, targets) { if (target) { return Promise.resolve(target); } return inquirer.prompt({ message: 'Which target do you want to build?', name: 'target', type: 'list', choices: targets }).then((answer) => answer.target); } module.exports = promptForTarget;