Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var cmd = this.cmd;
cmd = commandAliases[cmd] ? commandAliases[cmd] : cmd;
var action = this.commands[cmd];
this.insight.track('ember', cmd);
if (cmd && !action) {
this.ui.write('The specified command ' + chalk.underline(cmd) + ' is invalid, for available options see `ember help`\n\n');
return;
}
if (!action) {
action = this.commands.help;
}
var parseOpts = nopt.bind(null, action.types, action.shorthands);
var opts = parseOpts(this.argv);
if(defaults !== undefined) {
defaults = nopt(action.types, action.shorthands, defaults, 0);
} else {
defaults = {};
}
var options = merge({}, opts, defaults, {
appRoot: process.cwd(),
cliRoot: path.resolve(path.join(__dirname, '..'))
});
var args = options.argv.remain.slice();
args.shift(); // remove CMD