var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvTemplateApply=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _inquirer=_interopRequireDefault(require("inquirer"));
var _logger=require("../../core/systemManager/logger");
var _templateManager=require("../../core/templateManager");
var _taskManager=require("../../core/taskManager");
var _constants=require("../../core/constants");

var taskRnvTemplateApply=function taskRnvTemplateApply(c,parentTask,originTask){var opts,_await$inquirer$promp,template;return _regenerator.default.async(function taskRnvTemplateApply$(_context){while(1){switch(_context.prev=_context.next){case 0:
(0,_logger.logTask)('taskRnvTemplateApply',"template: "+c.program.template);_context.next=3;return _regenerator.default.awrap(

(0,_taskManager.executeTask)(c,_constants.TASK_PROJECT_CONFIGURE,_constants.TASK_TEMPLATE_APPLY,originTask));case 3:if(!

c.program.template){_context.next=10;break;}_context.next=6;return _regenerator.default.awrap(
(0,_templateManager.applyTemplate)(c,c.program.template));case 6:if(!
c.program.appConfigID){_context.next=9;break;}_context.next=9;return _regenerator.default.awrap(
(0,_taskManager.executeTask)(c,_constants.TASK_APP_CONFIGURE,_constants.TASK_TEMPLATE_APPLY,originTask));case 9:return _context.abrupt("return",


true);case 10:

opts=(0,_templateManager.getInstalledTemplateOptions)(c);_context.next=13;return _regenerator.default.awrap(

_inquirer.default.prompt({
type:'list',
message:'Pick which template to install',
name:'template',
choices:opts.keysAsArray}));case 13:_await$inquirer$promp=_context.sent;template=_await$inquirer$promp.template;_context.next=17;return _regenerator.default.awrap(


(0,_templateManager.applyTemplate)(c,template));case 17:if(!
c.program.appConfigID){_context.next=20;break;}_context.next=20;return _regenerator.default.awrap(
(0,_taskManager.executeTask)(c,_constants.TASK_APP_CONFIGURE,_constants.TASK_TEMPLATE_APPLY,originTask));case 20:return _context.abrupt("return",

true);case 21:case"end":return _context.stop();}}},null,null,null,Promise);};exports.taskRnvTemplateApply=taskRnvTemplateApply;var _default=


{
description:'Reset project to specific template',
fn:taskRnvTemplateApply,
task:'template apply',
params:_constants.PARAMS.withBase(),
platforms:[]};exports.default=_default;
//# sourceMappingURL=task.rnv.template.apply.js.map