<commit_before>/*
 * Copyright 2013, All Rights Reserved.
 *
 * Code licensed under the BSD License:
 * https://github.com/node-gh/gh/blob/master/LICENSE.md
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */

// -- Requires -----------------------------------------------------------------
var base = require('../base'),
    fs = require('fs'),
    logger = require('../logger'),
    path = require('path'),
    which = require('which');

// -- Constructor --------------------------------------------------------------
function Help() {}

// -- Constants ----------------------------------------------------------------
Help.DETAILS = {
    description: 'List all commands and options available.'
};

// -- Commands -----------------------------------------------------------------
Help.prototype.run = function() {
    var instance = this,
        cmdDir = path.join(__dirname, '../cmds/'),
        cmdList = base.find(cmdDir, /\.js$/),
        cmdOutput = [],
        nodeModulesPath = path.join(process.execPath, '/../../lib/node_modules'),
        plugins;

    // Remove help from command list
    cmdList.splice(cmdList.indexOf('help.js'), 1);

    // Get external plugins
    plugins = fs.readdirSync(nodeModulesPath).filter(function (plugin) {
        return plugin.substring(0, 3) === 'gh-';
    });

    plugins.forEach(function (cmd) {
        try {
            cmdList.push(which.sync(cmd));
        }
        catch(e) {
        }
    });

    cmdList.forEach(function(dir) {
        var cmd = require(path.resolve(cmdDir, dir));

        cmdOutput.push({
            alias: cmd.Impl.DETAILS.alias,
            description: cmd.Impl.DETAILS.description,
            flags: instance.groupOptions_(cmd.Impl.DETAILS),
            name: path.basename(dir, '.js').replace(/^gh-/, '')
        });
    });

    logger.logTemplateFile('help.handlebars', {
        commands: cmdOutput
    });<commit_msg>Source formatting<commit_after>/*
 * Copyright 2013, All Rights Reserved.
 *
 * Code licensed under the BSD License:
 * https://github.com/node-gh/gh/blob/master/LICENSE.md
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */

// -- Requires -----------------------------------------------------------------
var base = require('../base'),
    fs = require('fs'),
    logger = require('../logger'),
    path = require('path'),
    which = require('which');

// -- Constructor --------------------------------------------------------------
function Help() {}

// -- Constants ----------------------------------------------------------------
Help.DETAILS = {
    description: 'List all commands and options available.'
};

// -- Commands -----------------------------------------------------------------
Help.prototype.run = function() {
    var instance = this,
        cmdDir = path.join(__dirname, '../cmds/'),
        cmdList = base.find(cmdDir, /\.js$/),
        cmdOutput = [],
        nodeModulesPath = path.join(process.execPath, '/../../lib/node_modules'),
        plugins;

    // Remove help from command list
    cmdList.splice(cmdList.indexOf('help.js'), 1);

    // Get external plugins
    plugins = fs.readdirSync(nodeModulesPath).filter(function(plugin) {
        return plugin.substring(0, 3) === 'gh-';
    });

    plugins.forEach(function(cmd) {
        try {
            cmdList.push(which.sync(cmd));
        }
        catch(e) {
        }
    });

    cmdList.forEach(function(dir) {
        var cmd = require(path.resolve(cmdDir, dir));

        cmdOutput.push({
            alias: cmd.Impl.DETAILS.alias,
            description: cmd.Impl.DETAILS.description,
            flags: instance.groupOptions_(cmd.Impl.DETAILS),
            name: path.basename(dir, '.js').replace(/^gh-/, '')
        });
    });

    logger.logTemplateFile('help.handlebars', {
        commands: cmdOutput
    });
{'fraction_non_alphanumeric': 0.2826652785007808, 'fraction_numerical': 0.003643935450286309, 'mean_word_length': 1.5216535433070866, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '2798884', 'n_tokens_mistral': 1045, 'n_tokens_neox': 1011, 'n_words': 199}