patriot
Version:
Patriot command-line interface and node.js library.
39 lines (33 loc) • 786 B
JavaScript
/*!
* Module dependencies.
*/
var patriot = require('../main');
/**
* $ patriot create <path>
*
* Create a Cordova-compatible project.
*
* Options:
*
* - `argv` {Object} is an optimist object.
* - `callback` {Function} is a completion callback.
* - `e` {Error} is null unless there was an error.
*/
module.exports = function (argv, callback) {
// display help on $ patriot create
if (argv._.length <= 1) {
argv._.unshift('help');
this.argv(argv, callback);
return;
}
// project info
var data = {
path: argv._[1],
id: argv._[2] || argv.id || argv.i,
name: argv._[3] || argv.name || argv.n
};
// create the project
patriot.create(data, function (e) {
callback(e);
});
};