Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
command = ((args)[0] || 'cordova');
docdir = path.join(__dirname, '..', 'doc');
file = [
command + '.md',
command + '.txt',
'cordova.md',
'cordova.txt'
].map(function (file) {
var f = path.join(docdir, file);
if (fs.existsSync(f)) {
return f;
}
}).filter(function (f) {
return !!f;
});
raw = fs.readFileSync(file[0]).toString('utf8').replace(/cordova-cli/g, cordova_lib.binname);
// cordova.emit('results', raw);
return raw;
};
if (!args.help && remain[0] === 'help') {
remain.shift();
}
return printHelp(remain);
}
// Don't need to do anything with cordova-lib since config was handled above
if (cmd === 'config') return true;
if (cmd === 'create') {
const [, dest, id, name] = undashed;
return cordovaCreate(dest, { id, name, events, template: args.template });
}
if (!Object.prototype.hasOwnProperty.call(cordova, cmd)) {
var msg2 = 'Cordova does not know ' + cmd + '; try `' + cordova_lib.binname +
' help` for a list of all the available commands.';
throw new CordovaError(msg2);
}
var opts = {
platforms: [],
options: [],
verbose: args.verbose || false,
silent: args.silent || false,
nohooks: args.nohooks || [],
searchpath: args.searchpath
};
var platformCommands = ['emulate', 'build', 'prepare', 'compile', 'run', 'clean'];
if (platformCommands.indexOf(cmd) !== -1) {
// All options without dashes are assumed to be platform names