<commit_before>import program from 'commander';
import fs from 'fs';
import parser from './parser/parser';
import htmlFormatter from './formatters/htmlFormatter';

program
  .version('0.0.1')
  .usage('[options] file [outputFile]')
  .option('-f, --format [format]', 'Output format [format]', 'html')
  .option('-m, --margins [top, right, left, bottom]', 'Margins')
  .option('-w, --width [width]', 'Width')
  .option('-h, --height [height]', 'Height')
  .option('-va, --vertalign [align]', 'Vertical alignment', 'top/center/bottom')
  .parse(process.argv);

console.log('rtfToHtml v' + program.version());
console.log('Converting "' + program.args[0] + '" -> "' + program.args[1] + '"');
const options = {
    margins: [0, 0, 0, 0],
    vertAlign: 'top'
};
if (program.width) {
    options.width = program.width;
    console.log('--width ' + program.width)
}
if (program.height) {
    options.height = program.height;
    console.log('--height ' + program.height)
}
if (program.margins) {
    options.margins = JSON.parse(program.margins);
    console.log('--margins ' + program.margins)
}
if (program.vertalign) {
    options.vertAlign = program.vertalign;
    console.log('--vertalign ' + program.vertalign)
}

fs.readFile(program.args[0], 'utf8', (err, data) => {
    //console.log(data);
    const parsedRtf = parser.parse(data);
    console.log(JSON.stringify(parsedRtf, undefined, 2));
    const formatter = htmlFormatter;
    const output = formatter(parsedRtf, options);
    if (program.args.length >= 2) {
        fs.writeFile(program.args[1], output, (err) => {
            if (err) {
                console.log('ERROR: ' + err);
            }
        });
    }
});<commit_msg>Fixed lint errors<commit_after>import program from 'commander';
import fs from 'fs';
import parser from './parser/parser';
import htmlFormatter from './formatters/htmlFormatter';

program
  .version('0.0.1')
  .usage('[options] file [outputFile]')
  .option('-f, --format [format]', 'Output format [format]', 'html')
  .option('-m, --margins [top, right, left, bottom]', 'Margins')
  .option('-w, --width [width]', 'Width')
  .option('-h, --height [height]', 'Height')
  .option('-va, --vertalign [align]', 'Vertical alignment', 'top/center/bottom')
  .parse(process.argv);

console.log('rtfToHtml v' + program.version());
console.log('Converting "' + program.args[0] + '" -> "' + program.args[1] + '"');
const options = {
    margins: [0, 0, 0, 0],
    vertAlign: 'top'
};
if (program.width) {
    options.width = program.width;
    console.log('--width ' + program.width);
}
if (program.height) {
    options.height = program.height;
    console.log('--height ' + program.height);
}
if (program.margins) {
    options.margins = JSON.parse(program.margins);
    console.log('--margins ' + program.margins);
}
if (program.vertalign) {
    options.vertAlign = program.vertalign;
    console.log('--vertalign ' + program.vertalign);
}

fs.readFile(program.args[0], 'utf8', (err, data) => {
    if (err) {
        return console.error(err);
    }
    const parsedRtf = parser.parse(data);
    console.log(JSON.stringify(parsedRtf, undefined, 2));
    const formatter = htmlFormatter;
    const output = formatter(parsedRtf, options);
    if (program.args.length >= 2) {
        fs.writeFile(program.args[1], output, (err2) => {
            if (err2) {
                console.log('ERROR: ' + err2);
            }
        });
    }
});
{'fraction_non_alphanumeric': 0.19473684210526315, 'fraction_numerical': 0.009064327485380117, 'mean_word_length': 3.2869674185463658, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1498766', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1162, 'n_words': 239}