From 708106f90fb125ff01e88c3202ad534468cbeb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Sun, 25 Jan 2015 21:48:59 +0200 Subject: [PATCH] Call the library methods --- bin/git-stats | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bin/git-stats b/bin/git-stats index 41de4b4..3fe67db 100755 --- a/bin/git-stats +++ b/bin/git-stats @@ -1,2 +1,22 @@ #!/usr/bin/env node +var GitStats = require("../lib"); + +switch (process.argv[2]) { + case "--record": + var data = process.argv[3]; + try { + data = JSON.parse(data); + } catch (e) { + throw e; + } + GitStats.record(data, function (err) { + if (err) { throw err; } + }); + break; + default: + GitStats.get(function (err, data) { + console.log(err || data); + }); + break; +}