aboutsummaryrefslogtreecommitdiff
path: root/task-git.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtask-git.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/task-git.sh b/task-git.sh
index 620e197..26af83d 100755
--- a/task-git.sh
+++ b/task-git.sh
@@ -11,16 +11,24 @@ if [ ! -d "$DATA_DIR" ]; then
exit 1
fi
-# Create backups
-/usr/bin/task $@
-cd $DATA_DIR
-git add .
-git commit -m "$TASK_COMMAND" > /dev/null
# Check if --task-git-push is passed as an argument.
+PUSH=0
for i
do
if [ "$i" == "--task-git-push" ]; then
- git push origin master
+ # Set the PUSH flag, and remove this from the arguments list.
+ PUSH=1
+ shift
fi
done
+
+# Call task, commit files and push if flag is set.
+/usr/bin/task $@
+cd $DATA_DIR
+git add .
+git commit -m "$TASK_COMMAND" > /dev/null
+
+if [ "$PUSH" == 1 ]; then
+ git push origin master > /dev/null
+fi
exit 0