<commit_before>
var argv = require('minimist')(process.argv.slice(2));
var fs = require('fs-extra');
var hotBuilder = require('hot-builder');
var httpServer = require('http-server');
var merge = require('merge');
var path = require('path');
var Promise = require('promise');

var TESTS_DIR = 'test';
var RESULTS_DIR = 'benchmark/results';
var SAMPLE_SIZE = 100;
var SERVER_HOST = 'localhost';
var SERVER_PORT = '8080';

var BASE_URL = 'http://' + SERVER_HOST + ':' + SERVER_PORT + '/';
var hotVersion = null;
var hotBranch = hotBranch = argv['hot-branch'];
var runServer = hotBranch = argv['server'];

if (runServer) {
  runHttpServer();

  return;<commit_msg>Add cli subtasks<commit_after>
var argv = require('minimist')(process.argv.slice(2));
var dirTree = require('dir-tree');
var fs = require('fs-extra');
var hotBuilder = require('hot-builder');
var httpServer = require('http-server');
var merge = require('merge');
var path = require('path');
var Promise = require('promise');

var TESTS_DIR = 'test';
var RESULTS_DIR = 'benchmark/results';
var SAMPLE_SIZE = 100;
var SERVER_HOST = 'localhost';
var SERVER_PORT = '8080';

var BASE_URL = 'http://' + SERVER_HOST + ':' + SERVER_PORT + '/';
var hotVersion = null;
var hotBranch = argv['hot-branch'];
var runServer = argv['server'];
var genMapFile = argv['gen-map-file'];

if (runServer) {
  console.log('Running HTTP server (http://' + SERVER_HOST + ':' + 8080 + ')...');
  runHttpServer();

  return;
}
if (genMapFile) {
  console.log('Generating map file...');

  new Promise(function(resolve, reject) {
    fs.mkdirs(RESULTS_DIR, function(err) {
      if (err) {
        return reject(err);
      }
      resolve();
    });
  }).then(function() {
      return dirTree(RESULTS_DIR);

  }).then(function(tree) {
      return new Promise(function(resolve, reject) {
        fs.writeFile(path.resolve(RESULTS_DIR + '/map.json'), JSON.stringify(tree), function(err) {
          if (err) {
            return reject(err);
          }
          resolve();
        });
      });
  }).then(function() {
      console.log('Generated map file in ' + RESULTS_DIR + '/map.json');
  }).catch(function(error) {
      console.error('Error generating map ->', error);
  });

  return;
{'fraction_non_alphanumeric': 0.17797752808988765, 'fraction_numerical': 0.008988764044943821, 'mean_word_length': 3.8815789473684212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1614091', 'n_tokens_mistral': 746, 'n_tokens_neox': 719, 'n_words': 170}