var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvConfig=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _consoleTablePrinter=require("console-table-printer");

var _logger=require("../../core/systemManager/logger");
var _constants=require("../../core/constants");
var _config=_interopRequireDefault(require("../../core/configManager/config"));
var _common=require("../../core/common");

var taskRnvConfig=function taskRnvConfig(c){
(0,_logger.logTask)('taskRnvConfig');

var _getCliArguments=(0,_common.getCliArguments)(c),_getCliArguments2=(0,_slicedToArray2.default)(_getCliArguments,3),key=_getCliArguments2[1],value=_getCliArguments2[2];
if(key==='list'){var _ref;
var rows=[];
Object.keys(_constants.configSchema).forEach(function(k){return rows.push(_config.default.listConfigValue(k));});

(0,_consoleTablePrinter.printTable)((_ref=[]).concat.apply(_ref,rows));
return true;
}


if(!key){

(0,_logger.logWarning)('Please specify a config');
return true;
}
if(!_constants.configSchema[key]){
(0,_logger.logWarning)("Unknown config "+key);
return true;
}

if(!value){

(0,_consoleTablePrinter.printTable)(_config.default.listConfigValue(key));
}else if(_config.default.setConfigValue(key,value)){(0,_consoleTablePrinter.printTable)(_config.default.listConfigValue(key));}

return true;
};exports.taskRnvConfig=taskRnvConfig;var _default=

{
description:'Edit or display RNV configs',
fn:taskRnvConfig,
task:'config',
params:_constants.PARAMS.withBase(),
platforms:[]};exports.default=_default;
//# sourceMappingURL=task.rnv.config.js.map