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

var minimist = require('minimist')
var create = require('..')
var fs = require('fs')
var resolve = require('resolve')
var path = require('path')

var options = [
  'dependencies',
  'devDependencies',
  'status',
  'downloads',
  'version',
  'npm',
  'license',
  'node',
]

var portfolio = {
  major: ['status', 'dependencies', 'devDependencies', 'npm', 'version'],
  full: options,
  minor: ['status', 'version', 'npm'],
}
var argv = minimist(process.argv.slice(2), {
  boolean: ['help'].concat(options, Object.keys(portfolio)),
  string: ['user', 'repo'],
  alias: {
    d: 'dependencies',
    D: 'devDependencies',
    s: 'status',
    o: 'downloads',
    p: 'npm',
    l: 'license',
    n: 'node',
    v: 'version',

    U: 'user',
    R: 'repo',
    h: 'help',
  },
})

;(function () {
  if (argv.help) {
    fs.createReadStream(__dirname + '/help.txt')
      .pipe(process.stdout)
      .on('close', function () {
        process.exit(1)
      })
    return
  }

  if (argv.major) {
    portfolio.major.forEach(function (i) {
      argv[i] = true
    })
  } else if (argv.minor) {
    portfolio.minor.forEach(function (i) {
      argv[i] = true
    })
  } else if (argv.full) {
    portfolio.full.forEach(function (i) {
      argv[i] = true
    })
  }

  var info = {
    name: argv._[0],
    user: argv.user,
    repo: argv.repo,
  }

  resolve('./package.json', {
    basedir: process.cwd(),
    pathFilter: function () {
      return 'package.json'
    },
  }, function (err, file, pkg) {
    var url = pkg && pkg.repository && pkg.repository.url
    if (url) {
      var parts = url.split('/').slice(-2)
      var len = parts.length
      info.user = info.user || parts[0]
      info.repo = info.repo || parts[1].slice(0, -4)
      info.name = info.name || pkg.name
    }

    if (!info.repo) {
      info.repo = info.name
    }

    if (!info.name) {
      info.name = info.repo
    }

    options.forEach(function (opt) {
      if (argv[opt]) {
        var o = create(opt, info)
        if (o) {
          console.log(o.link)
        } else {
          if (options.indexOf(opt) === -1) {
            console.warn('WARN: `' + opt + '`not supported yet')
          } else {
            console.warn('Cannot create badge for `' + opt + '`')
            console.warn('Please make sure you are running the command where package.json lies, or user name, repo name, package name are provided properly in the command line')
          }
        }
      }
    })

  })

})()

<commit_msg>fix eslint<commit_after>#!/usr/bin/env node

var minimist = require('minimist')
var create = require('..')
var fs = require('fs')
var resolve = require('resolve')

var options = [
  'dependencies',
  'devDependencies',
  'status',
  'downloads',
  'version',
  'npm',
  'license',
  'node',
]

var portfolio = {
  major: ['status', 'dependencies', 'devDependencies', 'npm', 'version'],
  full: options,
  minor: ['status', 'version', 'npm'],
}
var argv = minimist(process.argv.slice(2), {
  boolean: ['help'].concat(options, Object.keys(portfolio)),
  string: ['user', 'repo'],
  alias: {
    d: 'dependencies',
    D: 'devDependencies',
    s: 'status',
    o: 'downloads',
    p: 'npm',
    l: 'license',
    n: 'node',
    v: 'version',

    U: 'user',
    R: 'repo',
    h: 'help',
  },
})

;(function () {
  if (argv.help) {
    fs.createReadStream(__dirname + '/help.txt')
      .pipe(process.stdout)
      .on('close', function () {
        process.exit(1)
      })
    return
  }

  if (argv.major) {
    portfolio.major.forEach(function (i) {
      argv[i] = true
    })
  } else if (argv.minor) {
    portfolio.minor.forEach(function (i) {
      argv[i] = true
    })
  } else if (argv.full) {
    portfolio.full.forEach(function (i) {
      argv[i] = true
    })
  }

  var info = {
    name: argv._[0],
    user: argv.user,
    repo: argv.repo,
  }

  resolve('./package.json', {
    basedir: process.cwd(),
    pathFilter: function () {
      return 'package.json'
    },
  }, function (err, file, pkg) {
    var url = pkg && pkg.repository && pkg.repository.url
    if (url) {
      var parts = url.split('/').slice(-2)
      info.user = info.user || parts[0]
      info.repo = info.repo || parts[1].slice(0, -4)
      info.name = info.name || pkg.name
    }

    if (!info.repo) {
      info.repo = info.name
    }

    if (!info.name) {
      info.name = info.repo
    }

    options.forEach(function (opt) {
      if (argv[opt]) {
        var o = create(opt, info)
        if (o) {
          return console.log(o.link)
        }
        if (options.indexOf(opt) === -1) {
          return console.warn('WARN: `' + opt + '`not supported yet')
        }
        console.warn('Cannot create badge for `' + opt + '`')
        console.warn('Please make sure you are running the command where package.json lies, or user name, repo name, package name are provided properly in the command line')
      }
    })

  })

})()


{'fraction_non_alphanumeric': 0.17879459786333401, 'fraction_numerical': 0.0036283007458173754, 'mean_word_length': 2.3102068045363575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4753075', 'n_tokens_mistral': 1739, 'n_tokens_neox': 1697, 'n_words': 403}