<commit_before>// Native
const {resolve} = require('path');

// External
const merge = require('webpack-merge');
const minimist = require('minimist');
const updateNotifier = require('update-notifier');

// Ours
const pkg = require('../../package');
const {getConfig} = require('../projects/config');
const {pack, packs, throws} = require('../utils/async');
const {createCommandLogo} = require('../utils/branding');
const {log} = require('../utils/logging');
const {slugToCamel} = require('../utils/strings');
const {ALIASES, COMMANDS, DEFAULTS, OPTIONS, MESSAGES} = require('./constants');

module.exports.cli = packs(async (args, isGlobal) => {
  const argv = minimist(args, OPTIONS);

  if (isGlobal) {
    updateNotifier({pkg, updateCheckInterval: 36e5}).notify();
  }

  if (argv.version) {
    return log(MESSAGES.version(pkg.version, !isGlobal));
  }

  let commandName = argv._[0] || '';
  const isHelp = (ALIASES[commandName] || commandName) === 'help';

  if (!commandName || (isHelp && argv._.length === 1)) {
    return log(MESSAGES.usage());
  }

  if (isHelp) {
    commandName = argv._[1] || '';
  }

  if (!COMMANDS.has(commandName)) {
    throw MESSAGES.unrecognised(commandName);
  }

  commandName = ALIASES[commandName] || commandName;

  const commandFn = require(
    resolve(__dirname, `../commands/${commandName}`)
  )[slugToCamel(commandName)];
  const commandFnArgs = isHelp ? ['--help'] : args.slice(1);

  throws(await commandFn(commandFnArgs));
});

let isEntryCommand;

module.exports.command = ({
  name,
  options,
  usage,
  isProxy,<commit_msg>Correctly handle `aunty help help`.<commit_after>// Native
const {resolve} = require('path');

// External
const merge = require('webpack-merge');
const minimist = require('minimist');
const updateNotifier = require('update-notifier');

// Ours
const pkg = require('../../package');
const {getConfig} = require('../projects/config');
const {pack, packs, throws} = require('../utils/async');
const {createCommandLogo} = require('../utils/branding');
const {log} = require('../utils/logging');
const {slugToCamel} = require('../utils/strings');
const {ALIASES, COMMANDS, DEFAULTS, OPTIONS, MESSAGES} = require('./constants');

const isArgHelpCommand = arg => {
  return (ALIASES[arg] || arg) === 'help';
};

module.exports.cli = packs(async (args, isGlobal) => {
  const argv = minimist(args, OPTIONS);

  if (isGlobal) {
    updateNotifier({pkg, updateCheckInterval: 36e5}).notify();
  }

  if (argv.version) {
    return log(MESSAGES.version(pkg.version, !isGlobal));
  }

  let commandName = argv._[0] || '';
  const isHelp = isArgHelpCommand(commandName);

  if (!commandName || (isHelp && (
    argv._.length === 1 || isArgHelpCommand(argv._[1])
  ))) {
    return log(MESSAGES.usage());
  }

  if (isHelp) {
    commandName = argv._[1] || '';
  }

  if (!COMMANDS.has(commandName)) {
    throw MESSAGES.unrecognised(commandName);
  }

  commandName = ALIASES[commandName] || commandName;

  const commandFn = require(
    resolve(__dirname, `../commands/${commandName}`)
  )[slugToCamel(commandName)];
  const commandFnArgs = isHelp ? ['--help'] : args.slice(1);

  throws(await commandFn(commandFnArgs));
});

let isEntryCommand;

module.exports.command = ({
  name,
  options,
  usage,
  isProxy,
{'fraction_non_alphanumeric': 0.18572735590118938, 'fraction_numerical': 0.004574565416285453, 'mean_word_length': 4.316045380875202, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '868295', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1071, 'n_words': 223}