<commit_before>/// <reference path="../../../typings/tsd.d.ts" />


import chalk = require('chalk');
chalk.enabled = true;

export const ERROR_UNSUPPORTED_COLOR:string = `Error logging message: The color sent to log the message unsupported
                                               Please send one of the following colors: red,blue,green,yellow`;

export function confirm(question:string,color?:string):Promise<boolean>
{
    var questionNew = question + '[y/n]';

    var promise = askInput(questionNew);

    return promise.then((answer)=>{
        if (answer.match(/\b(no|n)\b/i))
            return false;
        else if (answer.match(/\b(yes|y\b)/i))
            return true;
        else
            return confirm(question);
    });
}

export function askInput(message:string,color?:string):Promise<string>
{

    return new Promise(function (resolve) {

        var newMessage = message+":";
        if(color)
        {
            newMessage = chalk[color](newMessage).toString();
        }

        process.stdout.write(newMessage);
        process.stdin.setEncoding('utf8');
        var inputVal = '';
        process.stdin.on('data', function (data) {
            var lastChar = data.substr(data.length - 1, 1);
            if (lastChar === '\n' || lastChar === '\r' || lastChar === '\u0004') {
                process.stdin.removeAllListeners('data');
                inputVal += data.substr(0, data.length - 1);<commit_msg>making more cosmetic changes to cli<commit_after>/// <reference path="../../../typings/tsd.d.ts" />


import chalk = require('chalk');
chalk.enabled = true;

export const ERROR_UNSUPPORTED_COLOR:string = `Error logging message: The color sent to log the message unsupported
                                               Please send one of the following colors: red,blue,green,yellow`;

export function confirm(question:string,color?:string):Promise<boolean>
{
    var questionNew = question + '[y/n]';

    var promise = askInput(questionNew,color);

    return promise.then((answer)=>{
        if (answer.match(/\b(no|n)\b/i))
            return false;
        else if (answer.match(/\b(yes|y\b)/i))
            return true;
        else
            return confirm(question);
    });
}

export function askInput(message:string,color?:string):Promise<string>
{

    return new Promise(function (resolve) {

        var newMessage = message+":";
        if(color)
        {
            newMessage = chalk[color](newMessage).toString();
        }

        process.stdout.write(newMessage);
        process.stdin.setEncoding('utf8');
        var inputVal = '';
        process.stdin.on('data', function (data) {
            var lastChar = data.substr(data.length - 1, 1);
            if (lastChar === '\n' || lastChar === '\r' || lastChar === '\u0004') {
                process.stdin.removeAllListeners('data');
                inputVal += data.substr(0, data.length - 1);
{'fraction_non_alphanumeric': 0.14584763212079616, 'fraction_numerical': 0.0061770761839396015, 'mean_word_length': 2.327625570776256, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3825052', 'n_tokens_mistral': 840, 'n_tokens_neox': 798, 'n_words': 186}