blob: 26af83d6f685fb46a821790be780218eb7932afe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/bin/bash
# Get task command
TASK_COMMAND="task ${@}"
# Get data dir
DATA_RC=$(task _show | grep data.location)
DATA=(${DATA_RC//=/ })
DATA_DIR=${DATA[1]}
if [ ! -d "$DATA_DIR" ]; then
echo 'Could not load data directory!'
exit 1
fi
# Check if --task-git-push is passed as an argument.
PUSH=0
for i
do
if [ "$i" == "--task-git-push" ]; then
# 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
|