<commit_before>#!/usr/argv/env node

/**
 * Command line interface for generator.
 *
 * @package generator
 * @author <NAME> <<EMAIL>>
 */

/**
 * Dependencies
 */
var colors      = require('colors'),
    optimist    = require('optimist')
        .usage('Usage: $0 -t npm -n myModule')
        .alias('h', 'help')
        .alias('t', 'template')
        .alias('n', 'name')
        .alias('s', 'setup')
        .describe('t', 'Template name (from ~/.generator)')
        .describe('n', 'Name of project to be generated')
        .describe('s', 'Initializes the included modules at ~/.generator');

var argv        = optimist.argv,
    copy        = require('../lib/copy'),
    render      = require('../lib/render'),
    setup       = require('../lib/setup'),
    walk        = require('../lib/walk');

/**
 * Error handler
 */
function stderr (err) {
    console.log('Error: '.red + err.red);
    process.exit(1);
}

/**
 * Execute
 */
if (argv.help) return optimist.showHelp();
if (argv.setup) {
    setup(function (err) {
        if (err) return stderr(err);
        console.log('Done.'.green);
    });
} else {
    // Check requirements
    if (typeof argv.template === 'undefined' || argv.name === 'undefined') {
        return stderr('Template (-t) and project name (-n) must be specified. See --help');
    }

    // Replicate the template
    copy(argv.template, argv.name, function (err, path) {
        if (err) return stderr(err);

        // Walk and gather variables
        walk(path, argv.name, function (err, result) {
            console.dir(err);
            if (err) return stderr(err);

            // Render the results of the walk
            render(result, function (err) {
                if (err) return stderr(err);
                
                // Post-processing (make)
                console.log('Done.'.green);
            });
        });
    });
}<commit_msg>Remove console trace<commit_after>#!/usr/argv/env node

/**
 * Command line interface for generator.
 *
 * @package generator
 * @author <NAME> <<EMAIL>>
 */

/**
 * Dependencies
 */
var colors      = require('colors'),
    optimist    = require('optimist')
        .usage('Usage: $0 -t npm -n myModule')
        .alias('h', 'help')
        .alias('t', 'template')
        .alias('n', 'name')
        .alias('s', 'setup')
        .describe('t', 'Template name (from ~/.generator)')
        .describe('n', 'Name of project to be generated')
        .describe('s', 'Initializes the included modules at ~/.generator');

var argv        = optimist.argv,
    copy        = require('../lib/copy'),
    render      = require('../lib/render'),
    setup       = require('../lib/setup'),
    walk        = require('../lib/walk');

/**
 * Error handler
 */
function stderr (err) {
    console.log('Error: '.red + err.red);
    process.exit(1);
}

/**
 * Execute
 */
if (argv.help) return optimist.showHelp();
if (argv.setup) {
    setup(function (err) {
        if (err) return stderr(err);
        console.log('Done.'.green);
    });
} else {
    // Check requirements
    if (typeof argv.template === 'undefined' || argv.name === 'undefined') {
        return stderr('Template (-t) and project name (-n) must be specified. See --help');
    }

    // Replicate the template
    copy(argv.template, argv.name, function (err, path) {
        if (err) return stderr(err);

        // Walk and gather variables
        walk(path, argv.name, function (err, result) {
            if (err) return stderr(err);

            // Render the results of the walk
            render(result, function (err) {
                if (err) return stderr(err);
                
                // Post-processing (make)
                console.log('Done.'.green);
            });
        });
    });
}
{'fraction_non_alphanumeric': 0.17264276228419656, 'fraction_numerical': 0.0010624169986719787, 'mean_word_length': 1.9865186360031721, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4770660', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1103, 'n_words': 297}