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

var program = require('commander'),
    packageJSON = require('../package.json'),
    _ = require('lodash'),
    recurrimg = require('./index');

function list(val) {
    return _.map(val.split(','), function(n) {
        return parseInt(n);
    });
}

program
    .version(packageJSON.version)
    .option('-i, --image <url>', 'start image url')
    .option('-c, --count <n>', 'iteration count', parseInt)
    .option('-s, --server <url>', 'image search server url')
    .option('-o, --output <path>', 'output directory path for results')
    .option('--dimensions <x,y>', 'gif x/y dimensions (default = 100x100)', list)
    .option('--delay <n>', 'gif frame delay in ms (default = 100)', parseInt)
    .option('--quality <n>', 'gif image quality 1 - 256 (default = 10)', parseInt)
    .option('--repeat <n>', 'gif repeat: 0 = yes, -1 = no (default = 0)', parseInt)
    .parse(process.argv);

var params = {
    startImage: program.image,
    iterationCount: program.count,
    imageServer: program.server,
    outputDir: program.output,
    gifOptions: {
        dimensions: program.dimensions,
        delay: program.delay,
        quality: program.quality,
        repeat: program.repeat
    }
};

function dumpResultImageUrls(imageUrls) {
    console.log('#### begin dump ####');
    console.log(JSON.stringify(imageUrls));
    console.log('#### end dump ####');
}

try {
    recurrimg.go(params, function(err, resultImageUrls) {
        if (err) {
            console.error('Failure: ' + err.message);
            dumpResultImageUrls(resultImageUrls);
        } else {
            console.log('Success!');
        }
    });
} catch (err) {
    console.error();
    console.error('  Error: ' + err.message);
    program.help();
}
<commit_msg>Change CLI param name.<commit_after>#! /usr/bin/env node

var program = require('commander'),
    packageJSON = require('../package.json'),
    _ = require('lodash'),
    recurrimg = require('./index');

function list(val) {
    return _.map(val.split(','), function(n) {
        return parseInt(n);
    });
}

program
    .version(packageJSON.version)
    .option('-i, --start_image <url>', 'start image url')
    .option('-c, --count <n>', 'iteration count', parseInt)
    .option('-s, --server <url>', 'image search server url')
    .option('-o, --output <path>', 'output directory path for results')
    .option('--dimensions <x,y>', 'gif x/y dimensions (default = 100x100)', list)
    .option('--delay <n>', 'gif frame delay in ms (default = 100)', parseInt)
    .option('--quality <n>', 'gif image quality 1 - 256 (default = 10)', parseInt)
    .option('--repeat <n>', 'gif repeat: 0 = yes, -1 = no (default = 0)', parseInt)
    .parse(process.argv);

var params = {
    startImage: program.start_image,
    iterationCount: program.count,
    imageServer: program.server,
    outputDir: program.output,
    gifOptions: {
        dimensions: program.dimensions,
        delay: program.delay,
        quality: program.quality,
        repeat: program.repeat
    }
};

function dumpResultImageUrls(imageUrls) {
    console.log('#### begin dump ####');
    console.log(JSON.stringify(imageUrls));
    console.log('#### end dump ####');
}

try {
    recurrimg.go(params, function(err, resultImageUrls) {
        if (err) {
            console.error('Failure: ' + err.message);
            dumpResultImageUrls(resultImageUrls);
        } else {
            console.log('Success!');
        }
    });
} catch (err) {
    console.error();
    console.error('  Error: ' + err.message);
    program.help();
}

{'fraction_non_alphanumeric': 0.18138757314015047, 'fraction_numerical': 0.010030649205906938, 'mean_word_length': 2.872707659115426, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '7073179', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1145, 'n_words': 269}