"use strict";

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

var _child_process = require("child_process");

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

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

const supportedTemplates = ['app'];

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 ')}`);
    return;
  }

  const result = (0, _child_process.spawnSync)( // TODO this will (cp command) not work on Windows needs to recheck 
  'cp', ['-r', (0, _constants.getTemplatePath)(templateName)].concat(args), {
    stdio: 'inherit'
  });
  process.exit(result.status);
}