<commit_before>;
'use strict';

/**
 * x2db.js xls2database: xls reader + postgresql writer
 * <p>
 * License: Apache License v2.
 * 
 * @author xoykreme
 */

// main
(function() {
    var xls = require('xlsjs'), writer = require('./write2.js');
    var cli_opt, xlsfilepath, dbdata, workbook, first_sheet, titles, built;
    try {
        cli_opt = init_cli_opt();
        xlsfilepath = get_filepath(cli_opt);
        dbdata = get_db_details_prototype_object(cli_opt);
        if (filepath_exists(xlsfilepath)) {
            workbook = get_workbook(xlsfilepath);
            first_sheet = workbook.Sheets[workbook.SheetNames[0]];
            titles = cache_titles(first_sheet);
            built = build_rows(first_sheet);
            writer.write(dbdata,
                         titles,
                         built);
        }
    } catch (e) {
        console.log(e.stack);
        process.exit(1);
    }

})();

// cli options
function init_cli_opt() {
    var opt = require('node-getopt'), params = [];
    params.push([ 'f', '', 'File path' ]);
    params.push([ '', 'host', 'Database host' ]);
    params.push([ '', 'user', 'Database user name' ]);
    params.push([ '', 'pass', 'Database user password' ]);
    params.push([ 'h', 'help', 'Show this help message' ]);
    opt = opt.create(params).bindHelp().parseSystem();
    return opt;<commit_msg>Fixing bug where main x2db.js was requesting for write2.js, should be write.js<commit_after>;
'use strict';

/**
 * x2db.js xls2database: xls reader + postgresql writer
 * <p>
 * License: Apache License v2.
 * 
 * @author xoykreme
 */

// main
(function() {
    var xls = require('xlsjs'), writer = require('./write.js');
    var cli_opt, xlsfilepath, dbdata, workbook, first_sheet, titles, built;
    try {
        cli_opt = init_cli_opt();
        xlsfilepath = get_filepath(cli_opt);
        dbdata = get_db_details_prototype_object(cli_opt);
        if (filepath_exists(xlsfilepath)) {
            workbook = get_workbook(xlsfilepath);
            first_sheet = workbook.Sheets[workbook.SheetNames[0]];
            titles = cache_titles(first_sheet);
            built = build_rows(first_sheet);
            writer.write(dbdata,
                         titles,
                         built);
        }
    } catch (e) {
        console.log(e.stack);
        process.exit(1);
    }

})();

// cli options
function init_cli_opt() {
    var opt = require('node-getopt'), params = [];
    params.push([ 'f', '', 'File path' ]);
    params.push([ '', 'host', 'Database host' ]);
    params.push([ '', 'user', 'Database user name' ]);
    params.push([ '', 'pass', '<PASSWORD> user password' ]);
    params.push([ 'h', 'help', 'Show this help message' ]);
    opt = opt.create(params).bindHelp().parseSystem();
    return opt;
{'fraction_non_alphanumeric': 0.1563845050215208, 'fraction_numerical': 0.004662840746054519, 'mean_word_length': 2.534854245880862, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '1801670', 'n_tokens_mistral': 905, 'n_tokens_neox': 894, 'n_words': 194}