diff --git a/;w b/;w new file mode 100644 index 0000000..152cb3a --- /dev/null +++ b/;w @@ -0,0 +1,32 @@ +#!/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; +} diff --git a/bin/docs/help b/bin/docs/help new file mode 100644 index 0000000..9c8ed75 --- /dev/null +++ b/bin/docs/help @@ -0,0 +1,21 @@ +git-stats --help +A GitHub-like contributions calendar, but locally, with all your git commits. + +usage: git-stats [command] [data] + +options: + -v Displays version information. + -h --help Displays this help. + --no-ansi Doesn't use ANSI colors in the squares. + --record Records a new commit. Don't use this unless you are + a mad scientist. If you are a developer, just use this + option as part of the module. + +examples: + git-stats # Displays your commit calendar + git-stats -v + git-stats -h + +Your commit history is keept in the .git-stats, in your $HOME directory (~/) + +Documentation can be found at https://github.com/IonicaBizau/git-stats diff --git a/bin/git-stats b/bin/git-stats index 6383895..152cb3a 100755 --- a/bin/git-stats +++ b/bin/git-stats @@ -1,7 +1,11 @@ #!/usr/bin/env node -var GitStats = require("../lib"); +// Dependencies +var GitStats = require("../lib") + , Fs = require("fs") + ; +// CLI options switch (process.argv[2]) { case "--record": var data = process.argv[3].replace(/^\"|\"$/g, ""); @@ -15,12 +19,10 @@ switch (process.argv[2]) { }); break; case "--help": - // TODO - console.log( - "git-stats" - + "\nA GitHub-like contributions calendar, but locally, with all your git commits." - + "\n" - ); + console.log(Fs.readFileSync("./docs/help")); + break; + case "-v": + console.log(require("../package.json").version); break; default: GitStats.ansiCalendar(function (err, data) {