var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvWorkspaceConnect=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _prompt=require("../cli/prompt");
var _logger=require("../core/systemManager/logger");
var _workspace=require("../core/projectManager/workspace");
var _engineManager=require("../core/engineManager");
var _constants=require("../core/constants");

var taskRnvWorkspaceConnect=function taskRnvWorkspaceConnect(c,parentTask,originTask){var _c$files$rnv$configWo;var opts,_await$inquirerPrompt,selectedWS;return _regenerator.default.async(function taskRnvWorkspaceConnect$(_context){while(1){switch(_context.prev=_context.next){case 0:
(0,_logger.logTask)('taskRnvWorkspaceConnect');_context.next=3;return _regenerator.default.awrap(

(0,_engineManager.executeTask)(c,_constants.TASK_PROJECT_CONFIGURE,_constants.TASK_WORKSPACE_CONNECT,originTask));case 3:

opts=Object.keys((_c$files$rnv$configWo=c.files.rnv.configWorkspaces)==null?void 0:_c$files$rnv$configWo.workspaces).map(
function(v){var _c$files$rnv$configWo2;return v+" "+(0,_workspace.getWorkspaceConnectionString)((_c$files$rnv$configWo2=
c.files.rnv.configWorkspaces)==null?void 0:_c$files$rnv$configWo2.workspaces[v]);});_context.next=6;return _regenerator.default.awrap(



(0,_prompt.inquirerPrompt)({
type:'list',
name:'selectedWS',
message:'Pick a workspace',
choices:opts}));case 6:_await$inquirerPrompt=_context.sent;selectedWS=_await$inquirerPrompt.selectedWS;


(0,_logger.logRaw)(selectedWS);case 9:case"end":return _context.stop();}}},null,null,null,Promise);};exports.taskRnvWorkspaceConnect=taskRnvWorkspaceConnect;var _default=


{
description:'Connect project with selected workspace',
fn:taskRnvWorkspaceConnect,
task:_constants.TASK_WORKSPACE_CONNECT,
params:_constants.PARAMS.withBase(),
platforms:[],
isGlobalScope:true};exports.default=_default;
//# sourceMappingURL=task.rnv.workspace.connect.js.map