<commit_before>// Requirements
var optimist = require('optimist'),
    connect = require('connect'),
    http = require('http'),
    path = require('path'),
    verbose = require('./verbose'),
    open = require('open'),
    format = require('util').format;

// Process arguments
var argv = optimist
  .options('p', {
    alias: 'port',
    default: 3030
  })
  .options('d', {
    alias: 'directories',
    default: ''
  })
  .options('b', {
    alias: 'basepath',
    default: ''
  })
  .boolean('v').alias('v', 'verbose')
  .boolean('o').alias('o', 'open')
  .boolean('h').alias('h', 'help')
  .argv;

// Display help if requested
if (argv.h) {
  console.log('nws version %s', require('../package.json').version);
  // Optimist's showHelp function will not show boolean options
  console.log(require('fs').readFileSync(path.join(__dirname, 'help.txt'), 'utf8'));
  process.exit();
}

// Construct root paths array
var roots = argv.d.split(';').map(function (d) {
  return path.join(process.cwd(), d);
});

// Create app
var app = connect();
// Verbose?
if (argv.v) app.use(verbose);
// Use all given roots
roots.map(function (r) {
  return connect.static(r);
}).forEach(app.use.bind(app, '/' + argv.b));

// Start server
var server = http.createServer(app).listen(argv.p, function () {
  var addr = format('http://localhost:%d/%s', argv.p, argv.b);
  console.log('Listening at %s with root%s:', addr, roots.length > 1 ? 's' : '');
  roots.forEach(function (r) {
    console.log('\t%s', r);<commit_msg>Allow paths to be separated by colons as well as semi-colons.<commit_after>// Requirements
var optimist = require('optimist'),
    connect = require('connect'),
    http = require('http'),
    path = require('path'),
    verbose = require('./verbose'),
    open = require('open'),
    format = require('util').format;

// Process arguments
var argv = optimist
  .options('p', {
    alias: 'port',
    default: 3030
  })
  .options('d', {
    alias: 'directories',
    default: ''
  })
  .options('b', {
    alias: 'basepath',
    default: ''
  })
  .boolean('v').alias('v', 'verbose')
  .boolean('o').alias('o', 'open')
  .boolean('h').alias('h', 'help')
  .argv;

// Display help if requested
if (argv.h) {
  console.log('nws version %s', require('../package.json').version);
  // Optimist's showHelp function will not show boolean options
  console.log(require('fs').readFileSync(path.join(__dirname, 'help.txt'), 'utf8'));
  process.exit();
}

// Construct root paths array
var roots = argv.d.split(/[\;:]/).map(function (d) {
  return path.join(process.cwd(), d);
});

// Create app
var app = connect();
// Verbose?
if (argv.v) app.use(verbose);
// Use all given roots
roots.map(function (r) {
  return connect.static(r);
}).forEach(app.use.bind(app, '/' + argv.b));

// Start server
var server = http.createServer(app).listen(argv.p, function () {
  var addr = format('http://localhost:%d/%s', argv.p, argv.b);
  console.log('Listening at %s with root%s:', addr, roots.length > 1 ? 's' : '');
  roots.forEach(function (r) {
    console.log('\t%s', r);
{'fraction_non_alphanumeric': 0.21176470588235294, 'fraction_numerical': 0.00392156862745098, 'mean_word_length': 3.6099397590361444, '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': '7076164', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1031, 'n_words': 245}