<commit_before>/*
 * Copyright (c) 2011-2013, Yahoo! Inc.  All rights reserved.
 * Copyrights licensed under the New BSD License.
 * See the accompanying LICENSE file for terms.
 */
'use strict';

var load = require('../').load,
    log = require('../lib/log'),
    EOL = require('os').EOL;


function help(env) {
    var commands = Object.keys(env.cli.commands),
        out = ['Usage: mojito <command> [options]', env.cli.description];

    if (env.mojito) {
        env.mojito.commands.forEach(function(cmd) {
            if (commands.indexOf(cmd) === -1) {
                commands.push(cmd); // uniq commands
            }
        });
        commands.sort();
    }

    out.push('Available commands: ' + commands.join(', '));

    if (!env.mojito) {
        out.push(
            'Additional commands are available from within an application directory that',
            'has mojito installed.'
        );
    }

    return out.join(EOL);
}

function main(env, cb) {
    var cmd = env.args.shift() || '',
        mod,
        out = [];

    if (!cmd) {
        cb(null, help(env));
        return;
    }

    // apply command alias, i.e. "docs" -> "doc"
    if (!env.cli.commands[cmd] && env.cli.aliases[cmd]) {
        cmd = env.cli.aliases[cmd];
    }

    mod = load(cmd, env);
    if (mod && mod.usage) {
        cb(null, mod.usage);

    } else {
        help(env);
        cb('No help available for command ' + cmd);<commit_msg>rm msg that doesn't apply to mojito after cli removal<commit_after>/*
 * Copyright (c) 2011-2013, Yahoo! Inc.  All rights reserved.
 * Copyrights licensed under the New BSD License.
 * See the accompanying LICENSE file for terms.
 */
'use strict';

var load = require('../').load,
    log = require('../lib/log'),
    EOL = require('os').EOL;


function help(env) {
    var commands = Object.keys(env.cli.commands),
        out = ['Usage: mojito <command> [options]', env.cli.description];

    if (env.mojito) {
        env.mojito.commands.forEach(function(cmd) {
            if (commands.indexOf(cmd) === -1) {
                commands.push(cmd); // uniq commands
            }
        });
        commands.sort();
    }

    out.push('Available commands: ' + commands.join(', '));

    return out.join(EOL);
}

function main(env, cb) {
    var cmd = env.args.shift() || '',
        mod,
        out = [];

    if (!cmd) {
        cb(null, help(env));
        return;
    }

    // apply command alias, i.e. "docs" -> "doc"
    if (!env.cli.commands[cmd] && env.cli.aliases[cmd]) {
        cmd = env.cli.aliases[cmd];
    }

    mod = load(cmd, env);
    if (mod && mod.usage) {
        cb(null, mod.usage);

    } else {
        help(env);
        cb('No help available for command ' + cmd);
{'fraction_non_alphanumeric': 0.16569129480614483, 'fraction_numerical': 0.006583760058522311, 'mean_word_length': 2.069584736251403, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7009909', 'n_tokens_mistral': 905, 'n_tokens_neox': 867, 'n_words': 220}