Skip to content

Instantly share code, notes, and snippets.

@dariocravero
Created July 5, 2017 23:47
Show Gist options
  • Save dariocravero/75ee89e10615810e9352bf2812f8dc39 to your computer and use it in GitHub Desktop.
Save dariocravero/75ee89e10615810e9352bf2812f8dc39 to your computer and use it in GitHub Desktop.
contributions for file types per person
const { execSync } = require('child_process')
function getStatsFor(person) {
const data = execSync(
`git log --name-only --author=${person} --pretty=format: | sort | uniq | sort -nr`,
{
encoding: 'utf-8',
}
)
const files = data
.split('\n')
.filter(f => !/\.view\.js$/.test(f))
.map(f => f.substr(f.indexOf('.'), f.length))
.sort()
const count = {}
files.forEach(f => (count[f] = (count[f] || 0) + 1))
return Object.keys(count).map(f => `${f}\t${count[f]}`).join('\n')
}
console.log('Tom', getStatsFor('Tom'))
console.log('Dario', getStatsFor('Darío'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment