Added the config option which sets a cusotm config file

Fixed #8. 🎉
This commit is contained in:
Ionică Bizău 2015-07-12 15:23:14 +03:00
parent 5147e5ba7c
commit 2bd8226fe9

View file

@ -5,6 +5,7 @@ var GitStats = new (require("../lib"))()
, Moment = require("moment") , Moment = require("moment")
, Logger = require("bug-killer") , Logger = require("bug-killer")
, CLP = require("clp") , CLP = require("clp")
, Abs = require("abs")
, Package = require("../package") , Package = require("../package")
; ;
@ -20,6 +21,7 @@ var recordOpt = new CLP.Option(["record"], "Records a new commit. Don't use this
, authorsOpt = new CLP.Option(["a", "authors"], "Shows a pie chart with the author related contributions in the current repository.") , authorsOpt = new CLP.Option(["a", "authors"], "Shows a pie chart with the author related contributions in the current repository.")
, noAnsiOpt = new CLP.Option(["n", "no-ansi"], "Forces the tool not to use ANSI styles.") , noAnsiOpt = new CLP.Option(["n", "no-ansi"], "Forces the tool not to use ANSI styles.")
, lightOpt = new CLP.Option(["l", "light"], "Enables the light theme.") , lightOpt = new CLP.Option(["l", "light"], "Enables the light theme.")
, configPathOpt = new CLP.Option(["c", "config"], "Sets a custom config file.", "path")
, globalActivityOpt = new CLP.Option(["g", "global-activyt"], "Shows global activity calendar in the current repository.") , globalActivityOpt = new CLP.Option(["g", "global-activyt"], "Shows global activity calendar in the current repository.")
, parser = new CLP({ , parser = new CLP({
name: "Git Stats" name: "Git Stats"
@ -42,10 +44,14 @@ var recordOpt = new CLP.Option(["record"], "Records a new commit. Don't use this
, recordOpt , recordOpt
, authorsOpt , authorsOpt
, globalActivityOpt , globalActivityOpt
, configPathOpt
]) ])
, options = null , options = null
; ;
if (configPathOpt.is_provided) {
GitStats.path = Abs(configPathOpt.value);
}
// --record // --record
if (recordOpt.is_provided) { if (recordOpt.is_provided) {