var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Common",{enumerable:true,get:function get(){return _common.default;}});Object.defineProperty(exports,"Logger",{enumerable:true,get:function get(){return _logger.default;}});Object.defineProperty(exports,"Runner",{enumerable:true,get:function get(){return _runner.default;}});Object.defineProperty(exports,"App",{enumerable:true,get:function get(){return _app.default;}});Object.defineProperty(exports,"Platform",{enumerable:true,get:function get(){return _platform.default;}});Object.defineProperty(exports,"Target",{enumerable:true,get:function get(){return _target.default;}});Object.defineProperty(exports,"Constants",{enumerable:true,get:function get(){return _constants.default;}});Object.defineProperty(exports,"Exec",{enumerable:true,get:function get(){return _exec.default;}});Object.defineProperty(exports,"FileUtils",{enumerable:true,get:function get(){return _fileutils.default;}});Object.defineProperty(exports,"Doctor",{enumerable:true,get:function get(){return _doctor.default;}});Object.defineProperty(exports,"PlatformTools",{enumerable:true,get:function get(){return _platformTools.default;}});Object.defineProperty(exports,"PluginTools",{enumerable:true,get:function get(){return _pluginTools.default;}});Object.defineProperty(exports,"SetupTools",{enumerable:true,get:function get(){return _setupTools.default;}});exports.default=exports.run=void 0;var _chalk=_interopRequireDefault(require("chalk"));
var _common=_interopRequireWildcard(require("./common"));
var _logger=_interopRequireWildcard(require("./systemTools/logger"));
var _runner=_interopRequireDefault(require("./cli/runner"));
var _tools=_interopRequireDefault(require("./cli/tools"));
var _app=_interopRequireDefault(require("./cli/app"));
var _platform=_interopRequireDefault(require("./cli/platform"));
var _hooks=_interopRequireDefault(require("./cli/hooks"));
var _target=_interopRequireDefault(require("./cli/target"));
var _linker=_interopRequireDefault(require("./cli/linker"));
var _plugin=_interopRequireDefault(require("./cli/plugin"));
var _template=_interopRequireDefault(require("./cli/template"));
var _constants=_interopRequireDefault(require("./constants"));
var _exec=_interopRequireDefault(require("./systemTools/exec"));
var _fileutils=_interopRequireDefault(require("./systemTools/fileutils"));
var _doctor=_interopRequireDefault(require("./systemTools/doctor"));
var _platformTools=_interopRequireDefault(require("./platformTools"));
var _pluginTools=_interopRequireDefault(require("./pluginTools"));
var _setupTools=_interopRequireDefault(require("./setupTools"));

var commands={
start:_runner.default,
build:_runner.default,
export:_runner.default,
app:_app.default,
new:_app.default,
configure:_app.default,
switch:_app.default,
link:_linker.default,
platform:_platform.default,
run:_runner.default,
package:_runner.default,
deploy:_runner.default,
target:_target.default,
plugin:_plugin.default,
log:_runner.default,
hooks:_hooks.default,
status:_tools.default,
fix:_tools.default,
clean:_tools.default,
tool:_tools.default,
template:_template.default,
debug:_runner.default,
crypto:_tools.default};


var run=function run(cmd,subCmd,program,process){
(0,_common.initializeBuilder)(cmd,subCmd,process,program).
then(function(c){return checkWelcome(c);}).
then(function(c){return(0,_common.startBuilder)(c);}).
then(function(v){
if(commands[cmd]){
commands[cmd](v).
then(function(){
if(program.debug)(0,_logger.logInfo)('You started a debug build. Make sure you have the debugger started or start it with `rnv debug`');
(0,_logger.logComplete)(true);
}).
catch(function(e){return(0,_logger.logError)(e,true);});
}else if(program.help){

(0,_logger.logError)("Command "+_chalk.default.white(cmd)+" is not supported by ReNative CLI. Here is some help:");
logHelp();
(0,_logger.logComplete)(true);
}else{
(0,_logger.logError)("Command "+_chalk.default.white(cmd)+" is not supported by ReNative CLI. run "+_chalk.default.white('rnv')+" for help",true);
}
}).
catch(function(e){return(0,_logger.logError)(e,true);});
};exports.run=run;

var checkWelcome=function checkWelcome(c){return new Promise(function(resolve,reject){
if(!c.command&&!c.subCommand){
(0,_logger.logWelcome)();

logHelp();
}else{
resolve(c);
}
});};

var logHelp=function logHelp(){
var cmdsString='';
for(var key in commands){
cmdsString+=key+", ";
}

console.log("\n"+
_chalk.default.bold.white('COMMANDS:')+"\n\n"+

cmdsString+"\n\n"+

_chalk.default.bold.white('OPTIONS:')+"\n\n'-i, --info', 'Show full debug info'\n'-u, --update', 'Force update dependencies (iOS only)'\n'-p, --platform <value>', 'Select specific platform' // <ios|android|web|...>\n'-c, --appConfigID <value>', 'Select specific appConfigID' // <ios|android|web|...>\n'-t, --target <value>', 'Select specific simulator' // <.....>\n'-d, --device [value]', 'Select connected device'\n'-s, --scheme <value>', 'Select build scheme' // <Debug | Release>\n'-f, --filter <value>', 'Filter Value'\n'-l, --list', 'Return list of items related to command' // <alpha|beta|prod>\n'-r, --reset', 'Also perform reset'\n'-b, --blueprint', 'Blueprint for targets'\n'-h, --host <value>', 'Custom Host IP'\n'-x, --exeMethod <value>', 'Executable method in buildHooks'\n'-P, --port <value>', 'Custom Port'\n'-H, --help', 'Help'\n'-D, --debug', 'enable remote debugger'\n'--hosted', 'Run in a hosted environment (skip bundleAssets)'\n'--debugIp <value>', '(optional) overwrite the ip to which the remote debugger will connect'\n");




















};var _default=







{run:run};exports.default=_default;