<commit_before>import 'source-map-support/register';

import Bluebird from 'bluebird';
import EventEmitter from 'events';
import program from 'commander';
import { Migrator } from 'termigrator';

import {
  current,
  down,
  exec,
  goto,
  pending,
  up,
} from './commands';

/**
 * Cli class for migrator instance
 * @extends EventEmitter
 */
export default class Cli extends EventEmitter {
  constructor({ version, migrator, createMigrator, initialize }) {
    super();
    if (typeof version !== 'string') {
      throw new Error('args.version is required and must be a string');
    }
    if (!(migrator instanceof Migrator) && typeof createMigrator !== 'function') {
      throw new Error('args.migrator must be an instance of Termigrator.Migrator or factory function');
    } else {
      this.migrator = migrator;
      this.createMigrator = createMigrator;
    }
    if (typeof initialize !== 'function') {
      this.initialize = () => Bluebird.resolve();
    } else {
      this.initialize = () => Bluebird.try(() => initialize());
    }

    program.version(version);

    program.command('current')<commit_msg>fix(initialize): fixed missing context from initialize call<commit_after>import 'source-map-support/register';

import Bluebird from 'bluebird';
import EventEmitter from 'events';
import program from 'commander';
import { Migrator } from 'termigrator';

import {
  current,
  down,
  exec,
  goto,
  pending,
  up,
} from './commands';

/**
 * Cli class for migrator instance
 * @extends EventEmitter
 */
export default class Cli extends EventEmitter {
  constructor({ version, migrator, createMigrator, initialize }) {
    super();
    if (typeof version !== 'string') {
      throw new Error('args.version is required and must be a string');
    }
    if (!(migrator instanceof Migrator) && typeof createMigrator !== 'function') {
      throw new Error('args.migrator must be an instance of Termigrator.Migrator or factory function');
    } else {
      this.migrator = migrator;
      this.createMigrator = createMigrator;
    }
    if (typeof initialize !== 'function') {
      this.initialize = () => Bluebird.resolve();
    } else {
      this.initialize = () => Bluebird.try(() => initialize.call(this));
    }

    program.version(version);

    program.command('current')
{'fraction_non_alphanumeric': 0.12841648590021693, 'fraction_numerical': 0.0, 'mean_word_length': 3.5573122529644268, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2583388', 'n_tokens_mistral': 654, 'n_tokens_neox': 657, 'n_words': 197}