<commit_before>#!/usr/bin/env node
/**
 * An executable command which will be added to $PATH.
 *
 * @copyright Copyright 2016 <NAME> <<EMAIL>>
 * @license MIT
 */
'use strict';

var Command = require('commander').Command;
var modulename = require('..');
var packageJson = require('../package.json');

/** Result from command entry points.
 *
 * @typedef {{
 *   code: (?number|undefined),
 *   stdout: (?string|undefined),
 *   stderr: (?string|undefined)
 * }} CommandResult
 * @property {?number=} code Exit code for the command.
 * @property {?string=} stdout Content to write to stdout.
 * @property {?string=} stderr Content to write to stderr.
 */

/** Entry point for this command.
 *
 * @param {!Array<string>} args Command-line arguments.
 * @param {?function(Error, ?CommandResult=)=}
 * callback Callback for the command result or error.  Required if
 * <code>global.Promise</code> is not defined.
 * @return {Promise|undefined} If <code>callback</code> is not given and
 * <code>global.Promise</code> is defined, a <code>Promise</code> which will
 * resolve on completion.
 */
function modulenameCmd(args, callback) {
  if (!callback && typeof Promise === 'function') {
    return new Promise(function(resolve, reject) {
      modulenameCmd(args, function(err, result) {
        if (err) reject(err); else resolve(result);
      });
    });
  }

  if (typeof callback !== 'function') {
    throw new TypeError('callback must be a function');
  }

  // TODO:  Proxy console.{error,log} and process.exit so we can return result
  var command = new Command()
    // .arguments() splits on white space.  Call .parseExpectedArgs directly.
    .parseExpectedArgs(['<arg name>'])
    .option('-q, --quiet', 'print less output')
    .option('-v, --verbose', 'print more output')
    .version(packageJson.version)
    .parse(args);

  if (command.args.length !== 1) {
    callback(new Error('Exactly one argument is required.\n' +
          command.helpInformation()));
    return undefined;
  }

  // Parse arguments and call API function with parsed options
  modulename();
  return undefined;
}

module.exports = modulenameCmd;

if (require.main === module) {
  // This file was invoked directly.<commit_msg>Add description to commander invocation<commit_after>#!/usr/bin/env node
/**
 * An executable command which will be added to $PATH.
 *
 * @copyright Copyright 2016 <NAME> <<EMAIL>>
 * @license MIT
 */
'use strict';

var Command = require('commander').Command;
var modulename = require('..');
var packageJson = require('../package.json');

/** Result from command entry points.
 *
 * @typedef {{
 *   code: (?number|undefined),
 *   stdout: (?string|undefined),
 *   stderr: (?string|undefined)
 * }} CommandResult
 * @property {?number=} code Exit code for the command.
 * @property {?string=} stdout Content to write to stdout.
 * @property {?string=} stderr Content to write to stderr.
 */

/** Entry point for this command.
 *
 * @param {!Array<string>} args Command-line arguments.
 * @param {?function(Error, ?CommandResult=)=}
 * callback Callback for the command result or error.  Required if
 * <code>global.Promise</code> is not defined.
 * @return {Promise|undefined} If <code>callback</code> is not given and
 * <code>global.Promise</code> is defined, a <code>Promise</code> which will
 * resolve on completion.
 */
function modulenameCmd(args, callback) {
  if (!callback && typeof Promise === 'function') {
    return new Promise(function(resolve, reject) {
      modulenameCmd(args, function(err, result) {
        if (err) reject(err); else resolve(result);
      });
    });
  }

  if (typeof callback !== 'function') {
    throw new TypeError('callback must be a function');
  }

  // TODO:  Proxy console.{error,log} and process.exit so we can return result
  var command = new Command()
    .description('Does the thing with the thing and stuff.')
    // .arguments() splits on white space.  Call .parseExpectedArgs directly.
    .parseExpectedArgs(['<arg name>'])
    .option('-q, --quiet', 'print less output')
    .option('-v, --verbose', 'print more output')
    .version(packageJson.version)
    .parse(args);

  if (command.args.length !== 1) {
    callback(new Error('Exactly one argument is required.\n' +
          command.helpInformation()));
    return undefined;
  }

  // Parse arguments and call API function with parsed options
  modulename();
  return undefined;
}

module.exports = modulenameCmd;

if (require.main === module) {
  // This file was invoked directly.
{'fraction_non_alphanumeric': 0.14750830564784054, 'fraction_numerical': 0.0022148394241417496, 'mean_word_length': 3.66047471620227, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '6285837', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1298, 'n_words': 435}