<commit_before>import moment from 'moment';
import {
  argv
} from 'yargs';
import functions from './src/api/functions';


function processArguments(argv) {
  const options = argv;
  const startDT = moment(argv.start);
  const endDT = moment(startDT).add(argv.duration, 'minutes');

  return Object.assign({}, options, {
    startDT: startDT.toISOString(),
    endDT: argv.duration ? endDT.toISOString() : null,
    details: true,
    action: functions[argv.action] || functions['listEvents'],
  });
}

async function main(argv) {
  const options = processArguments(argv);
  const results = await options.action(options);
  if (!Array.isArray(results) || argv.details) {
    if (results.length > 0) {
      if (results[0].start) println(results);
    } else {
      console.log('Results is empty');
    }
  } else {<commit_msg>minor refactoring<commit_after>import moment from 'moment';
import {
  argv
} from 'yargs';
import functions from './src/api/functions';


function processArguments(argv) {
  const options = argv;
  const startDT = moment(argv.start);
  const endDT = moment(startDT).add(argv.duration, 'minutes');

  return Object.assign({}, options, {
    startDT: startDT.toISOString(),
    endDT: argv.duration ? endDT.toISOString() : null,
    details: true,
    action: functions[argv.action] || functions['listEvents'],
  });
}

async function main(argv) {
  const options = processArguments(argv);
  const results = await options.action(options);
  if (results && !Array.isArray(results)) {
    if (results.length > 0 && argv.details) {
      if (results[0].start) println(results);
    } else {
      console.log('Results is empty');
    }
  } else {
{'fraction_non_alphanumeric': 0.14739364889155182, 'fraction_numerical': 0.002396644697423607, 'mean_word_length': 3.940828402366864, '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': '1278830', 'n_tokens_mistral': 517, 'n_tokens_neox': 509, 'n_words': 126}