<commit_before>'use strict';

var relative = require('relative');

/**
 * Show a diff comparison of pre- and post-render content.
 */

module.exports = function diff_(verb) {
  var diff = false;
  verb.on('diff', function () {
    diff = true;
  });
  return function (file, next) {
    if (!diff) return next();

    console.log()
    console.log('- end -')
    console.log('---------------------------------------------------------------');
    console.log(relative(file.path));
    console.log()
    verb.diff(file.content, file.orig);
    next();
  };
};
<commit_msg>adds support for `argv.diff`<commit_after>'use strict';

var chalk = require('chalk');
var relative = require('relative');

/**
 * Show a diff comparison of pre- and post-render content.
 */

module.exports = function diff_(verb) {
  return function (file, next) {
    var diff = verb.get('argv.diff');

    if (!diff) return next();
    console.log()
    console.log('- end -')
    console.log('---------------------------------------------------------------');
    console.log(relative(file.path));
    console.log()

    if (file.content === '') {
      console.log(chalk.gray('  no content.'));
    } else if (file.content === file.orig) {
      console.log(chalk.gray('  content is unchanged.'));
    } else {
      verb.diff(file.orig, file.content, 'diffLines');
    }
    next();
  };
};

{'fraction_non_alphanumeric': 0.25896122896854423, 'fraction_numerical': 0.0, 'mean_word_length': 2.109090909090909, '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': '4000784', 'n_tokens_mistral': 407, 'n_tokens_neox': 401, 'n_words': 99}