<commit_before>/*!
 * Module dependencies.
 */

var path = require('path'),
    shell = require('shelljs');

/**
 * $ phonegap cordova [[commands] options]
 *
 * Execute an arbitrary Cordova CLI command.
 *
 * 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 $ phonegap cordova
    if (argv._.length <= 1) {
        argv._.unshift('help');
        this.argv(argv, callback);
        return;
    }

    // given the command:
    //    $ phonegap cordova run some command --foo=BAR
    // construct the equivalent cordova command:
    //    $ cordova run some command --foo=BAR
    cordovaCommand = Array.prototype.slice.call(process.argv);
    while(cordovaCommand[0] !== 'cordova') {
        cordovaCommand.shift();
    }
    cordovaCommand = cordovaCommand.join(' ');

    // use the local cordova node module
    // later on, we could alter this section to load the global cordova module
    var binPath = path.join(__dirname, '..', '..', 'node_modules', '.bin');
    cordovaCommand = path.join(binPath, cordovaCommand);

    // shell out the command to cordova
    var child = shell.exec(cordovaCommand, { async: true, silent: true }, function(code, output) {
        callback();
    });
    child.stdout.on('data', function(data) {
        console.log(data);
    });
};<commit_msg>[#343] Cordova CLI commands will emit raw formatting.<commit_after>/*!
 * Module dependencies.
 */

var path = require('path'),
    phonegap = require('../main'),
    shell = require('shelljs');

/**
 * $ phonegap cordova [[commands] options]
 *
 * Execute an arbitrary Cordova CLI command.
 *
 * 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 $ phonegap cordova
    if (argv._.length <= 1) {
        argv._.unshift('help');
        this.argv(argv, callback);
        return;
    }

    // given the command:
    //    $ phonegap cordova run some command --foo=BAR
    // construct the equivalent cordova command:
    //    $ cordova run some command --foo=BAR
    cordovaCommand = Array.prototype.slice.call(process.argv);
    while(cordovaCommand[0] !== 'cordova') {
        cordovaCommand.shift();
    }
    cordovaCommand = cordovaCommand.join(' ');

    // use the local cordova node module
    // later on, we could alter this section to load the global cordova module
    var binPath = path.join(__dirname, '..', '..', 'node_modules', '.bin');
    cordovaCommand = path.join(binPath, cordovaCommand);

    // shell out the command to cordova
    var child = shell.exec(cordovaCommand, { async: true, silent: true }, function(code, output) {
        callback();
    });
    child.stdout.on('data', function(data) {
        phonegap.emit('raw', data);
    });
};
{'fraction_non_alphanumeric': 0.1448321263989467, 'fraction_numerical': 0.002304147465437788, 'mean_word_length': 2.724264705882353, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2926029', 'n_tokens_mistral': 921, 'n_tokens_neox': 893, 'n_words': 264}