Help content and comments.

This commit is contained in:
Ionică Bizău 2015-01-30 15:14:28 +02:00
parent aeac7d801e
commit 323be11f05
3 changed files with 62 additions and 7 deletions

32
;w Normal file
View file

@ -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;
}

21
bin/docs/help Normal file
View file

@ -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 <data> 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

View file

@ -1,7 +1,11 @@
#!/usr/bin/env node #!/usr/bin/env node
var GitStats = require("../lib"); // Dependencies
var GitStats = require("../lib")
, Fs = require("fs")
;
// CLI options
switch (process.argv[2]) { switch (process.argv[2]) {
case "--record": case "--record":
var data = process.argv[3].replace(/^\"|\"$/g, ""); var data = process.argv[3].replace(/^\"|\"$/g, "");
@ -15,12 +19,10 @@ switch (process.argv[2]) {
}); });
break; break;
case "--help": case "--help":
// TODO console.log(Fs.readFileSync("./docs/help"));
console.log( break;
"git-stats" case "-v":
+ "\nA GitHub-like contributions calendar, but locally, with all your git commits." console.log(require("../package.json").version);
+ "\n"
);
break; break;
default: default:
GitStats.ansiCalendar(function (err, data) { GitStats.ansiCalendar(function (err, data) {