git-stats/;w

33 lines
742 B
Text
Raw Normal View History

2015-01-30 14:14:28 +01:00
#!/usr/bin/env node
// Dependencies
var GitStats = require("../lib")
, Fs = require("fs")
;
// CLI options
switch (process.argv[2]) {
case "--record":
var data = process.argv[3].replace(/^\"|\"$/g, "");
try {
data = JSON.parse(data);
} catch (e) {
throw e;
}
GitStats.record(data, function (err) {
if (err) { throw err; }
});
break;
case "--help":
console.log(Fs.readFileSync("./docs/help"));
break;
case "-v":
console.log(require("../package.json").version);
break;
default:
GitStats.ansiCalendar(function (err, data) {
console.log(err || data);
});
break;
}