"use strict";

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

var _constants = require("../../shared/constants");

var _logger = require("../../logger");

var _spawnSyncIO = require("../../shared/commands-utils/spawnSyncIO");

const supportedTemplates = ['app', 'library'];

function commandExecutor(options) {
  const {
    extraArgs = []
  } = options;
  const [templateName, ...args] = extraArgs;

  if (!supportedTemplates.includes(templateName)) {
    (0, _logger.messageLogger)(`template not supported "${templateName}" only these \n${supportedTemplates.join('\n ')} are supported`);
    return;
  }

  (0, _spawnSyncIO.spawnSyncIO)('cp', ['-r', (0, _constants.getTemplatePath)(templateName)].concat(args));
}