Fixed bug that was causing data path from config file to not be used.

Corrected config file path in help documentation.
This commit is contained in:
Ben Hollomon 2018-01-17 08:54:58 -06:00
parent 11c37ae513
commit bca433fbec

View file

@ -85,7 +85,7 @@ new Tilda(`${__dirname}/../package.json`, {
, "git-stats -s '1 January 2012' # All the commits from 1 January 2012 to now" , "git-stats -s '1 January 2012' # All the commits from 1 January 2012 to now"
, "git-stats -s '1 January 2012' -u '31 December 2012' # All the commits from 2012" , "git-stats -s '1 January 2012' -u '31 December 2012' # All the commits from 2012"
] ]
, notes: "Your commit history is kept in ~/.git-stats by default. You can create ~/.git-stats-config.json to specify different defaults." , notes: "Your commit history is kept in ~/.git-stats by default. You can create ~/.git-stats-config.js to specify different defaults."
}).main(action => { }).main(action => {
let recordOpt = action.options.record let recordOpt = action.options.record
@ -101,13 +101,8 @@ new Tilda(`${__dirname}/../package.json`, {
let options = {}; let options = {};
// Handle data path if(GitStats.config.path) {
if (dataPathOpt.is_provided) { dataPathOpt.is_provided = true;
GitStats.path = Abs(dataPathOpt.value);
GitStats.config.data_path = GitStats.path;
if (!IsThere(GitStats.path)) {
Logger.log("Cannot find the the specified data path file.", "warn");
}
} }
if (GitStats.config.authors) { if (GitStats.config.authors) {
@ -118,6 +113,17 @@ new Tilda(`${__dirname}/../package.json`, {
globalActivityOpt.is_provided = true; globalActivityOpt.is_provided = true;
} }
// Handle data path
if (dataPathOpt.is_provided) {
if (IsThere(dataPathOpt.value)) {
GitStats.path = Abs(dataPathOpt.value);
GitStats.config.data_path = GitStats.path;
}
else {
Logger.log("Cannot find the the specified data path file.", "warn");
}
}
// --record // --record
if (recordOpt.is_provided) { if (recordOpt.is_provided) {
try { try {