<commit_before>#! /usr/bin/env node

var prompt = require('prompt'),
  tm = require('./task-manager'),
  chalk = require('chalk');

var promptProps = {
  properties: {
    command: {
      message: 'Command (? for help)'
    }
  }
};

var taskManager = new tm();

prompt.start();

function doPrompt() {
  prompt.get(promptProps, function(err, result) {
    if (result && result.command) {
      if (!execute(result.command)) {
        return;
      }
    }

    doPrompt();
  });
}

/**
 * @returns true if we should prompt for another task. fals otherwise
 */
function execute(command) {
  if (command.indexOf('start') === 0) {
    return taskManager.startNewTask(command.substring(5).trim());
  } else if (command == 'stopall') {
    return taskManager.stopAllTasks();
  } else if (command.indexOf('stop') === 0) {
    return taskManager.stopCurrentTask(command.substring(4).trim());
  } else if (command.indexOf('print') === 0) {
    return taskManager.print(command.substring(5).trim());
  } else if (command === 'pause') {
    return taskManager.pause();
  } else if (command === 'resume') {
    return taskManager.resume();
  } else if (command === '?') {
    printHelp();
  } else if (command === 'q') {
    return false;
  } else if (command === '?') {
    printHelp();
  } else {
    console.log(chalk.red('Command not found!!'));
    printHelp();
  }

  return true;
}

function printHelp() {
  console.log(chalk.blue('Available Commands:'));
  console.log(chalk.bold('start <task name>') + ' Start a new task with the given name.');
  console.log(chalk.bold('stop <comment>') + ' Stop the current task. If a comment is specified it will be appended to the task name.');
  console.log(chalk.bold('stopall') + ' Stop all running tasks.');
  console.log(chalk.bold('print <yyy-mm-dd>') + ' Prints all tasks for the given day.');
  console.log(chalk.bold('q') + ' Quit the application.');
}

doPrompt();<commit_msg>help prints command in a different color now. Commands and the description are easier to distingush<commit_after>#! /usr/bin/env node

var prompt = require('prompt'),
  tm = require('./task-manager'),
  chalk = require('chalk');

var promptProps = {
  properties: {
    command: {
      message: 'Command (? for help)'
    }
  }
};

var taskManager = new tm();

prompt.start();

function doPrompt() {
  prompt.get(promptProps, function(err, result) {
    if (result && result.command) {
      if (!execute(result.command)) {
        return;
      }
    }

    doPrompt();
  });
}

/**
 * @returns true if we should prompt for another task. fals otherwise
 */
function execute(command) {
  if (command.indexOf('start') === 0) {
    return taskManager.startNewTask(command.substring(5).trim());
  } else if (command == 'stopall') {
    return taskManager.stopAllTasks();
  } else if (command.indexOf('stop') === 0) {
    return taskManager.stopCurrentTask(command.substring(4).trim());
  } else if (command.indexOf('print') === 0) {
    return taskManager.print(command.substring(5).trim());
  } else if (command === 'pause') {
    return taskManager.pause();
  } else if (command === 'resume') {
    return taskManager.resume();
  } else if (command === '?') {
    printHelp();
  } else if (command === 'q') {
    return false;
  } else if (command === '?') {
    printHelp();
  } else {
    console.log(chalk.red('Command not found!!'));
    printHelp();
  }

  return true;
}

function printHelp() {
  console.log(chalk.blue('Available Commands:'));
  console.log(chalk.green('start <task name>') + ' Start a new task with the given name.');
  console.log(chalk.green('stop <comment>') + ' Stop the current task. If a comment is specified it will be appended to the task name.');
  console.log(chalk.green('stopall') + ' Stop all running tasks.');
  console.log(chalk.green('print <yyy-mm-dd>') + ' Prints all tasks for the given day.');
  console.log(chalk.green('q') + ' Quit the application.');
}

doPrompt();
{'fraction_non_alphanumeric': 0.1761118170266836, 'fraction_numerical': 0.0030495552731893264, 'mean_word_length': 3.5397923875432524, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4574268', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1251, 'n_words': 328}