Skip to content

Instantly share code, notes, and snippets.

@d6u
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save d6u/22fe22445fb882ad6f0a to your computer and use it in GitHub Desktop.

Select an option

Save d6u/22fe22445fb882ad6f0a to your computer and use it in GitHub Desktop.
// Usage:
// $ node standup.js
//
// Specify distance of days to look back
// $ node standup.js -d 7 # look back 7 days
//
// It have auto author detection, so you don't have to specify any user
//
// It also has auto Monday correction, so on Monday, if you didn't specify `-d`,
// it will auto use 3 days range
var fs = require('fs');
var exec = require('child_process').exec;
var argv = process.argv;
if (argv[2] === '-d' && argv[3]) {
var distance = argv[3];
} else {
var distance = ((new Date).getDay() === 1) ? 3 : 1;
}
fs.readdir('./', function(err, files) {
files.forEach(function(dir) {
fs.stat(dir, function(err, stats) {
if (stats.isDirectory()) {
var command = 'git log --since="'+distance+' day ago" --pretty=format:"%h,%an,%ad,\"%s\"" --author="$(git config --get user.name)" --all';
exec(command, {
cwd: __dirname + '/' + dir
}, function(err, stdout, stderr) {
// Filter empty stdout
if (!/^\s*$/.test(stdout)) {
console.log('--> in ' + dir + ', found:')
console.log('---------------------------------')
console.log(stdout);
} else {
console.log('--> You haven\'t done any work in ' + dir);
}
});
}
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment