<commit_before>'use strict';

var node_path = require('path');
var commander = require('comfort');

// cli entrance
// cache commander instance
module.exports = commander({
    command_root: node_path.join( __dirname, 'command'),
    option_root : node_path.join( __dirname, 'option'),
    name: 'cortex'
});
<commit_msg>add error handler<commit_after>'use strict';

var node_path = require('path');
var commander = require('comfort');
var logger = require('./logger');

// cli entrance
// cache commander instance
module.exports = commander({
    command_root: node_path.join( __dirname, 'command'),
    option_root : node_path.join( __dirname, 'option'),
    name: 'cortex'

}).on('complete', function(e) {
    if(e.err){
        logger.error(e.err);
        logger.debug(e.data);

        return;
    }else{
        logger.end();
    }

}).on('commandNotFound', function(e) {
    logger.error(
        logger.template( '{{name}}: "{{command}}" is not a {{name}} command. See "{{name}} --help".', {
            name: e.name,
            command: e.command
        });
    );
});

{'fraction_non_alphanumeric': 0.17483811285846437, 'fraction_numerical': 0.0, 'mean_word_length': 3.193798449612403, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1598887', 'n_tokens_mistral': 336, 'n_tokens_neox': 332, 'n_words': 81}