<commit_before>
/**
 * parse the commandline args for --path
 *
 * If not found then locate
 * .supercolliderjs json preferences file
 * starting in cwd
 *
 */

var program = require('commander'),
    join = require('path').join,
    pkg = require(join(__dirname, '../../package.json')),
    RcFinder = require('rcfinder'),
    prefsFinder = new RcFinder('.supercolliderjs', {});


function parse() {
  program
    .version(pkg.version)
    .option('-p, --path <path>', 'Directory of sclang and scsynth [default=/Applications/SuperCollider/SuperCollider.app/Contents/Resources]')
    .parse(process.argv);

  var opts = prefsFinder.find(process.cwd()) || {};

  if(program.path) {
    opts.path = program.path;
  }

  return opts;
}

module.exports = parse;<commit_msg>factor out getPreferences<commit_after>
/**
 * parse the commandline args for --path
 *
 * If not found then locate
 * .supercolliderjs json preferences file
 * starting in cwd
 *
 */

var program = require('commander'),
    join = require('path').join,
    pkg = require(join(__dirname, '../../package.json')),
    RcFinder = require('rcfinder'),
    prefsFinder = new RcFinder('.supercolliderjs', {});


function getPreferences(path) {
  return prefsFinder.find(path || process.cwd()) || {};
}


function parse() {
  program
    .version(pkg.version)
    .option('-p, --path <path>', 'Directory of sclang and scsynth [default=/Applications/SuperCollider/SuperCollider.app/Contents/Resources]')
    .parse(process.argv);

  var opts = getPreferences();

  if(program.path) {
    opts.path = program.path;
  }

  return opts;
}


module.exports = parse;
{'fraction_non_alphanumeric': 0.15721331689272502, 'fraction_numerical': 0.0, 'mean_word_length': 3.6107954545454546, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4483037', 'n_tokens_mistral': 517, 'n_tokens_neox': 511, 'n_words': 118}