<commit_before>const dir = require('node-dir');
const readline = require('readline');
const open = require("open");

const sourceDir = process.cwd();

dir.promiseFiles(sourceDir)
    .then(files => {
        return files.filter(name => name.match(/\.txt$/))
    })
    .then(solutionFiles => {
        if (solutionFiles.length === 0) {
            console.log(`No solution file found in "${sourceDir}"`)
            return;
        }

        if (solutionFiles.length === 1) {
            const selected = solutionFiles[0];
            console.log(`Opening "${selected}"...`);
            open(selected);
            return;
        }

        console.log("");
        console.log("Multiple solution files found...")
        console.log("");

        for(let i = 0; i < solutionFiles.length; i++) {
            const option = solutionFiles[i];
            console.log(`  ${i+1}: ${option}`);
        }

        console.log("");

        const rl = readline.createInterface({
            input: process.stdin,
            output: process.stdout
        });

        rl.question("Please select which to open: ", (answer) => {
            const index = parseInt(answer) - 1;
            const selected = solutionFiles[index];

            if (selected) {
                console.log(`Opening "${selected}"...`);
                open(selected);
            } else {
                console.log(`Error, unrecognized value of "${answer}". The options was 1-${solutionFiles.length}.`);
            }

            rl.close();
        });                
    });<commit_msg>changed error message when selecting a value outside the suggested range<commit_after>const dir = require('node-dir');
const readline = require('readline');
const open = require("open");

const sourceDir = process.cwd();

dir.promiseFiles(sourceDir)
    .then(files => {
        return files.filter(name => name.match(/\.txt$/))
    })
    .then(solutionFiles => {
        if (solutionFiles.length === 0) {
            console.log(`No solution file found in "${sourceDir}"`)
            return;
        }

        if (solutionFiles.length === 1) {
            const selected = solutionFiles[0];
            console.log(`Opening "${selected}"...`);
            open(selected);
            return;
        }

        console.log("");
        console.log("Multiple solution files found...")
        console.log("");

        for(let i = 0; i < solutionFiles.length; i++) {
            const option = solutionFiles[i];
            console.log(`  ${i+1}: ${option}`);
        }

        console.log("");

        const rl = readline.createInterface({
            input: process.stdin,
            output: process.stdout
        });

        rl.question("Please select which to open: ", (answer) => {
            const index = parseInt(answer) - 1;
            const selected = solutionFiles[index];

            if (selected) {
                console.log(`Opening "${selected}"...`);
                open(selected);
            } else {
                console.log(`Error, unrecognized value of "${answer}". The value should have been between 1-${solutionFiles.length}.`);
            }

            rl.close();
        });                
    });
{'fraction_non_alphanumeric': 0.15149625935162095, 'fraction_numerical': 0.004364089775561097, 'mean_word_length': 1.7663793103448275, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1927909', 'n_tokens_mistral': 866, 'n_tokens_neox': 833, 'n_words': 199}