<commit_before>var stylperjade = require('../lib/stylperjade')
  , package = require('../package.json')
  , updateNotifier = require('update-notifier')

function run(program) {

  updateNotifier({ pkg: package }).notify()

  var cssFiles = parseArgs(program.args, 0)
    , jadeFiles = parseArgs(program.args, 1)
    , options = {}

  if (cssFiles[0] === '.' && !jadeFiles.length) {
    cssFiles = [ '**/*.css' ]
    jadeFiles = [ '**/*.jade' ]
  }

  if (!cssFiles.length || !jadeFiles.length) {
    program.help()
  }

  if (program.config) {
    options.stylperjaderc = program.config
  }

  try {
    stylperjade(cssFiles, jadeFiles, options, function (err, results) {
      if (err) {
        console.error(err)
        process.exit(1)
      }

      if (results.blacklistedTotal > 0 || results.unusedTotal > 0) {
        console.error(results.report)
      } else if (program.verbose) {
        console.log(results.report)
      }

      process.exit()
    })
  } catch (err) {
    console.error(err)
    process.exit(1)
  }

  function parseArgs(args, index) {

    return args && args[index] && typeof args[index] === 'string' ? [ args[index] ] : []<commit_msg>> Improve argument parsing<commit_after>var stylperjade = require('../lib/stylperjade')
  , package = require('../package.json')
  , updateNotifier = require('update-notifier')

function run(program) {

  updateNotifier({ pkg: package }).notify()

  var cssFiles = []
    , jadeFiles = []
    , options = {}

  parseArgs(program.args)

  if (!cssFiles.length || !jadeFiles.length) {
    program.help()
  }

  if (program.config) {
    options.stylperjaderc = program.config
  }

  try {
    stylperjade(cssFiles, jadeFiles, options, function (err, results) {
      if (err) {
        console.error(err)
        process.exit(1)
      }

      if (results.blacklistedTotal > 0 || results.unusedTotal > 0) {
        console.error(results.report)
      } else if (program.verbose) {
        console.log(results.report)
      }

      process.exit()
    })
  } catch (err) {
    console.error(err)
    process.exit(1)
  }

  function parseArgs(args) {

    if (args.length === 1 && args[0] === '.') {
      cssFiles = [ '**/*.css' ]
      jadeFiles = [ '**/*.jade' ]
    } else {
      cssFiles = args[0] && typeof args[0] === 'string' ? [ args[0] ] : []
      jadeFiles = args[1] && typeof args[1] === 'string' ? [ args[1] ] : []
    }
{'fraction_non_alphanumeric': 0.17173822426010837, 'fraction_numerical': 0.007919966652771988, 'mean_word_length': 2.6199095022624435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '3972213', 'n_tokens_mistral': 848, 'n_tokens_neox': 817, 'n_words': 150}