mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2025-01-03 18:32:11 +01:00
33 lines
742 B
Text
33 lines
742 B
Text
|
#!/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;
|
||
|
}
|