<commit_before>'use strict';

var _ = require('lodash');
var Table = require('cli-table');
var treeify = require('treeify');
var moment = require('moment');

var fecom = require('./fecom');
var Component = require('./component/Component');

module.exports = function (semantic) {
  var parsed = fecom.parse(semantic);
  var component = new Component(parsed, 'remote');

  return component.getInformation()
    .then(function (result) {
      var info = _.pick(result.info, ['name', 'description', 'owner', 'version', 'author']);
      var infoTable = new Table({
        colWidths: [15, 40]
      });
      _.forIn(info, function (value, key) {
        infoTable.push([key, value]);
      });
      var versionTable = new Table({
        head: ['version', 'detail'],
        colWidths: [15, 40]
      });
      var versions = result.versions.map(function (version) {
        var row = [];
        var meta = [];
        row.push(version.name);
        meta.push(version.commit.message.replace('\n', ''));
        meta.push(moment(version.commit.committed_date).format('YYYY-MM-DD HH:mm') + ' ' + version.commit.author_name);
        row.push(meta.join('\n'));
        return row;
      });

      versions.forEach(function (version) {
        versionTable.push(version);
      });

      fecom.logger.info(fecom.i18n('COMPONENT_INFORMATION', infoTable.toString()));
      fecom.logger.info(fecom.i18n('COMPONENT_VERSIONS', versionTable.toString()));
    })
    .catch(fecom.errorHandler);
};<commit_msg>#52 bug修复<commit_after>'use strict';

var _ = require('lodash');
var Table = require('cli-table');
var treeify = require('treeify');
var moment = require('moment');

var fecom = require('./fecom');
var Component = require('./component/Component');

module.exports = function (semantic) {
  var parsed = fecom.parse(semantic);
  var component = new Component(parsed, 'remote');

  return component.getInformation()
    .then(function (result) {
      var winChars = {
        'top': ' ',
        'top-mid': ' ',
        'top-left': ' ',
        'top-right': ' ',
        'bottom': ' ',
        'bottom-mid': ' ',
        'bottom-left': ' ',
        'bottom-right': ' ',
        'left': '',
        'left-mid': '',
        'mid': ' ',
        'mid-mid': ' ',
        'right': '',
        'right-mid': '',
        middle: ''
      };
      var winStyle = {
        'padding-left': 0,
        'padding-right': 0
      };
      var info = _.pick(result.info, ['name', 'description', 'owner', 'version', 'author']);
      var infoTable = new Table({
        colWidths: [15, 40],
        chars: process.platform === 'win32' ? winChars : {},
        style: process.platform === 'win32' ? winStyle : {}
      });
      _.forIn(info, function (value, key) {
        infoTable.push([key, value]);
      });
      var versionTable = new Table({
        head: ['version', 'detail'],
        colWidths: [15, 40],
        chars: process.platform === 'win32' ? winChars : {},
        style: process.platform === 'win32' ? winStyle : {}
      });
      var versions = result.versions.map(function (version) {
        var row = [];
        var meta = [];
        row.push(version.name);
        meta.push(version.commit.message.replace('\n', ''));
        meta.push(moment(version.commit.committed_date).format('YYYY-MM-DD HH:mm') + ' ' + version.commit.author_name);
        row.push(meta.join('\n'));
        return row;
      });

      versions.forEach(function (version) {
        versionTable.push(version);
      });

      fecom.logger.info(fecom.i18n('COMPONENT_INFORMATION', infoTable.toString()));
      fecom.logger.info(fecom.i18n('COMPONENT_VERSIONS', versionTable.toString()));
    })
    .catch(fecom.errorHandler);
};
{'fraction_non_alphanumeric': 0.18445818768486152, 'fraction_numerical': 0.009680021511158914, 'mean_word_length': 2.6151603498542273, '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': '5671024', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1134, 'n_words': 218}