<commit_before>/*!
 * code-points | MIT (c) <NAME>
 * https://github.com/shinnn/code-points.js
*/
'use strict';

var fs = require('fs');

var argv = require('minimist')(process.argv.slice(2), {
  alias: {
    u: 'unique',
    uniq: 'unique',
    f: 'file',
    h: 'help',
    v: 'version'
  },
  string: ['_', 'file'],
  boolean: ['unique', 'help', 'version']
});
var pkg = require('./package.json');

function help() {
  var chalk = require('chalk');

  console.log([
    chalk.cyan(pkg.name) + chalk.gray(' v' + pkg.version),
    pkg.description,
    '',
    'Usage1: ' + pkg.name + ' <string>',
    'Usage2: ' + pkg.name + ' --file <file path>',
    'Usage3: cat <file path> | ' + pkg.name,
    '',
    'Options:',
    chalk.yellow('--unique, --uniq, -u') + '  Remove duplicates from result',
    chalk.yellow('--file,           -f') + '  Use a file as an input',
    chalk.yellow('--help,           -h') + '  Print usage information',
    chalk.yellow('--version,        -v') + '  Print version',
    ''
  ].join('\n'));
}

function run(str) {
  var points = require('./')(str, {unique: argv.unique});
  console.log(points.join(','));
}

function stderrWriteLn(msg) {
  process.stderr.write(msg + '\n', function() {
    process.exit(1);
  });
}

if (argv.version) {
  console.log(pkg.version);
} else if (argv.help) {
  help();
} else if (process.stdin.isTTY) {
  if (argv.file) {
    if (!fs.existsSync(argv.file)) {
      stderrWriteLn('Cannot read the file ' + argv.file + '.');
    } else if (!fs.statSync(argv.file).isFile()) {
      stderrWriteLn(argv.file + ' is not a file.');
    } else {
      run(fs.readFileSync(argv.file).toString());
    }
  } else if (argv._.length === 0) {
    help();
  } else {<commit_msg>introduce sum-up to the cli<commit_after>/*!
 * code-points | MIT (c) <NAME>
 * https://github.com/shinnn/code-points.js
*/
'use strict';

var argv = require('minimist')(process.argv.slice(2), {
  alias: {
    u: 'unique',
    uniq: 'unique',
    f: 'file',
    h: 'help',
    v: 'version'
  },
  string: ['_', 'file'],
  boolean: ['unique', 'help', 'version']
});

function help() {
  var sumUp = require('sum-up');
  var yellow = require('chalk').yellow;

  var pkg = require('./package.json');

  console.log([
    sumUp(pkg),
    '',
    'Usage1: ' + pkg.name + ' <string>',
    'Usage2: ' + pkg.name + ' --file <file path>',
    'Usage3: cat <file path> | ' + pkg.name,
    '',
    'Options:',
    yellow('--unique, --uniq, -u') + '  Remove duplicates from result',
    yellow('--file,           -f') + '  Use a file as an input',
    yellow('--help,           -h') + '  Print usage information',
    yellow('--version,        -v') + '  Print version',
    ''
  ].join('\n'));
}

function run(str) {
  var points = require('./')(str, {unique: argv.unique});
  console.log(points.join(','));
}

function stderrWriteLn(msg) {
  process.stderr.write(msg + '\n', function() {
    process.exit(1);
  });
}

if (argv.version) {
  console.log(require('./package.json').version);
} else if (argv.help) {
  help();
} else if (process.stdin.isTTY) {
  if (argv.file) {
    var fs = require('fs');

    if (!fs.existsSync(argv.file)) {
      stderrWriteLn('Cannot read the file ' + argv.file + '.');
    } else if (!fs.statSync(argv.file).isFile()) {
      stderrWriteLn(argv.file + ' is not a file.');
    } else {
      run(fs.readFileSync(argv.file).toString());
    }
  } else if (argv._.length === 0) {
    help();
  } else {
{'fraction_non_alphanumeric': 0.22074159907300117, 'fraction_numerical': 0.0034762456546929316, 'mean_word_length': 2.7009646302250805, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '5050241', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1262, 'n_words': 269}