#!/bin/sh
# copyright 2014 Renato Alves
# distributed under the GPL licence
if [ -z "$TASKDIR" ]; then
#TODO Look for data location in rc:location instead of assuming ~/.taskrc
TASKDIR="$(grep data.location $HOME/.taskrc | cut -d '=' -f 2)"
fi
if [ -z "$TASKBIN" ]; then
TASKBIN="task"
fi
$TASKBIN "$@"
EXITCODE="$?"
if [ -d "$TASKDIR" ]; then
cd "$TASKDIR"
else
echo "Couldn't navigate to TASKDIR: $TASKDIR"
exit $EXITCODE
fi
if ! [ -d "$TASKDIR/.git" ]; then
git init 2>&1 > git.log
echo "git.log" > .gitignore
echo "git.log.old" >> .gitignore
echo "*.pem" >> .gitignore
git add .gitignore 2>&1 >> git.log
git add *.data *.theme 2>&1 >> git.log
git commit -a -m "Initial log" 2>&1 >> git.log
fi
if [ "$#" -gt "0" ]; then
git add *.data *.theme 2>&1 >> git.log
git commit -a -m "$*" 2>&1 >> git.log
fi
# Rotate git.log if bigger than 1M
if [ "$(stat -c '%s' git.log)" -gt "1000000" ]; then
mv -f git.log git.log.old
touch git.log
fi
exit $EXITCODE
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.