<commit_before>#!/usr/bin/env node

'use strict';

const semver = require('semver');
const path = require('upath');

const cliRunName = './cli-run';
const pkgName = './package';
const localCliPath = path.join(process.cwd(), 'node_modules', '@pingy', 'cli');

const run = (type) => {
  try {
    const cliPath = type === 'local' ? localCliPath : null;
    /* eslint-disable global-require, import/no-dynamic-require */
    const cli = require(cliPath ? path.join(cliPath, cliRunName) : cliRunName);
    const pkg = require(cliPath ? path.join(cliPath, pkgName) : pkgName);
    /* eslint-enable global-require, import/no-dynamic-require */
    console.log(`${pkg.version} (${type})`);
    cli.run();
  } catch (err) {
    if (semver.lte(process.version, '6.0.0') && err.name === 'SyntaxError') {
      console.log(
        `Pingy CLI is compatible with Node v6+. You are running ${process.version}. Please upgrade Node.`
      );
    } else {
      throw err;
    }
  }
};

try {
  // Try and run local version of Pingy CLI
  run('local');
} catch (e) {
  // Fallback to global
  run('global');
}<commit_msg>[cli] Drop support for node v6. Now requires node v7.10.1+.<commit_after>#!/usr/bin/env node

'use strict';

const semver = require('semver');
const path = require('upath');

const cliRunName = './cli-run';
const pkgName = './package';
const localCliPath = path.join(process.cwd(), 'node_modules', '@pingy', 'cli');

const run = type => {
  try {
    const cliPath = type === 'local' ? localCliPath : null;
    /* eslint-disable global-require, import/no-dynamic-require */
    const cli = require(cliPath ? path.join(cliPath, cliRunName) : cliRunName);
    const pkg = require(cliPath ? path.join(cliPath, pkgName) : pkgName);
    /* eslint-enable global-require, import/no-dynamic-require */
    console.log(`${pkg.version} (${type})`);
    cli.run();
  } catch (err) {
    if (semver.lte(process.version, '7.10.1') && err.name === 'SyntaxError') {
      console.log(
        `Pingy CLI is compatible with Node v7.10.1+. You are running ${
          process.version
        }. Please upgrade Node.`
      );
    } else {
      throw err;
    }
  }
};

try {
  // Try and run local version of Pingy CLI
  run('local');
} catch (e) {
  // Fallback to global
  run('global');
}
{'fraction_non_alphanumeric': 0.1730937773882559, 'fraction_numerical': 0.007449605609114811, 'mean_word_length': 3.0913978494623655, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7178394', 'n_tokens_mistral': 798, 'n_tokens_neox': 773, 'n_words': 197}