<commit_before>#!/usr/bin/env node
'use strict';

var cli = require('commander');
var readPkg = require('read-pkg');
var notifier = require('update-notifier');

// up to date?
var pkg = readPkg.sync(__dirname);
notifier({pkg: pkg}).notify();

// setup debugger
var debug = require('debug')('exbox');
debug.log = function () {
	arguments[0] = arguments[0].replace(/^(.*?exbox )/, '[DEBUG] ');
	return console.log.apply(console, arguments);
};

cli.version(pkg.version)
	.usage('<command> [args...] [options]')
	.on('--help', function () {
		console.log('  For additional help with any command, run `exbox COMMAND -h`');
		console.log();
	});

cli
	.command('init')
	.description('setup ExBox for the first time')
	.usage(' ') // no options
	.action(function () {
		console.log('inside init!');
	});

cli
	.command('domain <site> <dir>')
	.description('Map a Domain to a VM directory')
	.option('--ssl', '     Enable SSL on this domain')
	.action(function (site, dir, opts) {
		var ssl = opts.ssl || false;
		debug('domain: use ssl: %s. site: %s. dir: %s.', ssl, site, dir);
		//
	}).on('--help', addExamples.bind(null, [
		'$ exbox domain phoenix.dev /home/vagrant/code/phoenix',
		'$ exbox domain hello-world.app /home/vagrant/code/hello-world',
		'$ exbox domain --ssl secure.app /home/vagrant/code/secure',
		'$ exbox domain secure.app /home/vagrant/code/secure --ssl'
	]));

cli.parse(process.argv);

/**
 * Log examples to the Console, with formatting
 * @param {Array} arr
 */
function addExamples(arr) {
	console.log('  Examples: \n');
	arr.forEach(function (el) {
		console.log('    ' + el);
	});
	console.log();
}<commit_msg>update examples helper, more formatting less repetition<commit_after>#!/usr/bin/env node
'use strict';

var cli = require('commander');
var readPkg = require('read-pkg');
var notifier = require('update-notifier');

// up to date?
var pkg = readPkg.sync(__dirname);
notifier({pkg: pkg}).notify();

// setup debugger
var debug = require('debug')('exbox');
debug.log = function () {
	arguments[0] = arguments[0].replace(/^(.*?exbox )/, '[DEBUG] ');
	return console.log.apply(console, arguments);
};

cli.version(pkg.version)
	.usage('<command> [args...] [options]')
	.on('--help', function () {
		console.log('  For additional help with any command, run `exbox COMMAND -h`');
		console.log();
	});

cli
	.command('init')
	.description('setup ExBox for the first time')
	.usage(' ') // no options
	.action(function () {
		console.log('inside init!');
	});

cli
	.command('domain <site> <dir>')
	.description('Map a Domain to a VM directory')
	.option('--ssl', '     Enable SSL on this domain')
	.action(function (site, dir, opts) {
		var ssl = opts.ssl || false;
		debug('domain: use ssl: %s. site: %s. dir: %s.', ssl, site, dir);
		//
	}).on('--help', addExamples.bind(null, 'domain', [
		'phoenix.dev /home/vagrant/code/phoenix',
		'hello-world.app /home/vagrant/code/hello-world',
		'--ssl secure.app /home/vagrant/code/secure',
		'secure.app /home/vagrant/code/secure --ssl'
	]));

cli.parse(process.argv);

/**
 * Log examples to the Console, with formatting
 * @param {String} cmd    The name of the command in question
 * @param {Array} arr     An array of example usages
 */
function addExamples(cmd, arr) {
	console.log('  Examples: \n');
	arr.forEach(function (el) {
		console.log(['    $ exbox', cmd, el].join(' '));
	});
	console.log();
}
{'fraction_non_alphanumeric': 0.20124297129328203, 'fraction_numerical': 0.0011837821840781297, 'mean_word_length': 3.8703170028818445, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1473185', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1177, 'n_words': 303}