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

/* eslint-env node, es6 */

/* eslint-disable no-process-exit */

'use strict';

const path = require('path');

const app = require('commander');
const chalk = require('chalk');

const cosi = require(path.resolve(path.join(__dirname, '..', 'lib', 'cosi')));
const Cassandra = require(path.resolve(path.join(cosi.lib_dir, 'plugins', 'cassandra')));

app.
    version(cosi.app_version).
    option('--enable', 'enable the postgres plugin').
    option('--disable', 'disable the postgres plugin').
    option('--noregister', 'do not perform automatic registration step').
    parse(process.argv);

if (!app.quiet) {
    console.log(chalk.bold(app.name()), `v${app.version()}`);
}

if (app.enable && app.disable) {
    app.outputHelp();
    console.error(chalk.red('ERROR'), chalk.bold('enable'), 'and', chalk.bold('disable'), 'are mutually exclusive');
    process.exit(1);
}

if (!app.enable && !app.disable) {
    app.outputHelp();
    console.error(chalk.red('ERROR'), 'must specify one of', chalk.bold('enable'), 'or', chalk.bold('disable'));
    process.exit(1);
}


const plugin = new Cassandra(app);

plugin.once('plugin.done', (err) => {
    if (err !== null) {
        console.error(chalk.red('ERROR'), err);
        process.exit(1);
    }<commit_msg>upd: add --force option to overwrite plugin configs<commit_after>#!/usr/bin/env node

/* eslint-env node, es6 */

/* eslint-disable no-process-exit */

'use strict';

const path = require('path');

const app = require('commander');
const chalk = require('chalk');

const cosi = require(path.resolve(path.join(__dirname, '..', 'lib', 'cosi')));
const Cassandra = require(path.resolve(path.join(cosi.lib_dir, 'plugins', 'cassandra')));

app.
    version(cosi.app_version).
    option('--enable', 'enable the postgres plugin').
    option('--disable', 'disable the postgres plugin').
    option('--noregister', 'do not perform automatic registration step').
    option('--force', 'overwrite plugin configs if already enabled').
    parse(process.argv);

if (!app.quiet) {
    console.log(chalk.bold(app.name()), `v${app.version()}`);
}

if (app.enable && app.disable) {
    app.outputHelp();
    console.error(chalk.red('ERROR'), chalk.bold('enable'), 'and', chalk.bold('disable'), 'are mutually exclusive');
    process.exit(1);
}

if (!app.enable && !app.disable) {
    app.outputHelp();
    console.error(chalk.red('ERROR'), 'must specify one of', chalk.bold('enable'), 'or', chalk.bold('disable'));
    process.exit(1);
}


const plugin = new Cassandra(app);

plugin.once('plugin.done', (err) => {
    if (err !== null) {
        console.error(chalk.red('ERROR'), err);
        process.exit(1);
    }
{'fraction_non_alphanumeric': 0.20378619153674832, 'fraction_numerical': 0.002969561989606533, 'mean_word_length': 4.065789473684211, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '959457', 'n_tokens_mistral': 904, 'n_tokens_neox': 883, 'n_words': 192}