From 34d48dcb6a00bf7d960a7acb10b34fda471e067a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Sun, 1 Feb 2015 08:24:53 +0200 Subject: [PATCH] Installation steps --- README.md | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 59ba72c..0f5959c 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,43 @@ A GitHub-like contributions calendar, but locally, with all your git commits. $ npm install -g git-stats ``` +Then put the following lines in your `~/.bashrc` file: + +```sh +git() { + cmd=$1 + shift + extra="" + + quoted_args="" + whitespace="[[:space:]]" + for i in "$@" + do + quoted_args="$quoted_args \"$i\"" + done + + cmdToRun="`which git` "$cmd" $quoted_args" + cmdToRun=`echo $cmdToRun | sed -e 's/^ *//' -e 's/ *$//'` + bash -c "$cmdToRun" + if [ $? -eq 0 ]; then + # Commit stats + if [ "$cmd" == "commit" ]; then + commit_hash=`git rev-parse HEAD` + repo_url=`git config --get remote.origin.url` + commit_date=`git log -1 --format=%cd` + commit_data="\"{ \"date\": \"$commit_date\", \"url\": \"$repo_url\", \"hash\": \"$commit_hash\" }\"" + git-stats --record "$commit_data" + fi + fi +} +``` + + ## Documentation -## `record(data, callback)` +### `record(data, callback)` Records a new commit. -### Params +#### Params - **Object** `data`: The commit data containing: - `date` (String|Date): The date object or a string in this format: `DDD MMM dd HH:mm:ss YYYY` - `url` (String): The repository remote url. @@ -19,10 +51,10 @@ Records a new commit. - **Function** `callback`: The callback function. -## `get(data, callback)` +### `get(data, callback)` Gets the git stats. -### Params +#### Params - **Object** `data`: The stats filter. **Not yet implemented**. - **Function** `callback`: The callback function.