const inquirer = require('inquirer');

/**
 * Asks user to which bucket the App should be released.
 */
function promptForBucket(bucket, buckets) {
  if (bucket) { return Promise.resolve(bucket); }

  return inquirer.prompt({
    message: 'Which bucket do you want to use?',
    name: 's3Bucket',
    type: 'list',
    choices: buckets
  }).then((answer) => answer.s3Bucket);
}

module.exports = promptForBucket;
