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

// Parse the commandline arguments
var args = process.argv.slice(2);

// The first argument is the command.
if (args.length == 0) {
    console.error("You need to specify the command that shall be executed.")
    process.exit(1);
}

var commands = {
    "generate": function (args) {
        if (args.length !== 1) {
            console.error("You need to specify the name of the new resolver.");
            process.exit(1);
        }
        console.error("Not yet implemented. Please stand by!");
        // FIXME: Implement!
    }<commit_msg>Add resolve command<commit_after>#!/usr/bin/env node

var fs = require('fs');

// Parse the commandline arguments
var args = process.argv.slice(2);

// The first argument is the command.
if (args.length == 0) {
    console.error("You need to specify the command that shall be executed.")
    process.exit(1);
}

var commands = {
    "generate": function (args) {
        if (args.length !== 1) {
            console.error("You need to specify the name of the new resolver.");
            process.exit(1);
        }
        console.error("Not yet implemented. Please stand by!");
        // FIXME: Implement!
    },
    "resolve": function (args) {
        if (args.length == 0) {
            console.error("You need to specify a resolver to utilise.");
            process.exit(1);
        }
        if (args.length < 3 || args.length > 4) {
            console.error("Usage: \n\t tomahawkjs resolve <resolver> <artist> <title> [<album>]");
            process.exit(1);
        }
        fs.stat(args[0], function (err, stats) {
            if (err) {
                console.error("Error while reading the resolver path:");
                console.error(err);
                process.exit(1);
            }
            if (stats.isFile()) {
                // Load the resolver from a (zipped) bundle.
                // FIXME: Implement!
            } else if (stats.isDirectory()) {
                // Load the resolver from a directory.
                // FIXME: Implement!
            } else {
                // Will be interesting what kind of fs type people will access here
                console.error("Unsupported FS item for a resolver bundle.");
                process.exit(1);
            }
        });
    }
{'fraction_non_alphanumeric': 0.12705984388551606, 'fraction_numerical': 0.007805724197745013, 'mean_word_length': 1.8202933985330074, 'pattern_counts': {'":': 3, '<': 8, '<?xml version=': 0, '>': 8, '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': '1897988', 'n_tokens_mistral': 643, 'n_tokens_neox': 628, 'n_words': 203}