"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sanitizeProjectName = sanitizeProjectName;
exports.validateProjectName = validateProjectName;
exports.getProjectName = getProjectName;

var _inquirer = require("inquirer");

/**
 * Trims the project name.
 * Only exported for testing
 *
 * @param projectName  The project name that should be trimmed
 */
function sanitizeProjectName(projectName) {
  return projectName.trim();
}
/**
 * Validates that the project name can be used for the coat manifest.
 * Only exported for testing.
 *
 * @param projectName The project name that should be validated
 */


function validateProjectName(projectName) {
  return projectName.length > 0;
}
/**
 * Prompts for the project name for the coat project that will be created.
 *
 * @param suggestedName An optional suggested name that the user will be prompted with
 */


async function getProjectName(suggestedName) {
  const {
    projectName
  } = await (0, _inquirer.prompt)([{
    name: "projectName",
    message: "Enter the name of your new project",
    filter: sanitizeProjectName,
    default: suggestedName || "my-project",
    validate: validateProjectName
  }]);
  return projectName;
}