Browse Source

fixing git behaviour and making it quiet

master
Ben Savage 5 years ago
parent
commit
a193cab9c5
  1. 17
      cl

17
cl

@ -121,7 +121,7 @@ function captains_log() {
TODAY=$(date +%F)
TOMORROW=$(date +%F -d "+${modT:-1} day")
if [ ${GIT:-1} ] && [ -f "$CLDIR/.git" ]; then
if [ ${GIT:-1} ] && [ -d "$CLDIR/.git" ]; then
GIT=1
else
GIT=0
@ -131,8 +131,8 @@ function captains_log() {
mkdir "$CLDIR"
fi
if [ $GIT ]; then
git -C "$CLDIR" pull &
if [ $GIT -ne 0 ]; then
git -C "$CLDIR" pull -q &
fi
@ -148,7 +148,7 @@ function captains_log() {
"$CLDIR/template" > $CLDIR/${!i}
elif [ -f "$CLDIR/template" ]; then
DATE_ARGS="$(grep '{{DATE[^}]*}}' "$CLDIR/template"|tr -d {}|cut -d' ' -f2-)"
if [ "$DATE_ARGS" == '' ]; then DATE_ARGS='%A %d %B %Y'; fi
if [ "$DATE_ARGS" == 'DATE' ]; then DATE_ARGS='%A %d %B %Y'; fi
debug "From static template with DATE_ARGS=$DATE_ARGS"
sed "s/{{DATE[^}]*}}/$(date "+$DATE_ARGS" -d ${!i})/g" $CLDIR/template > $CLDIR/${!i}
else
@ -195,11 +195,12 @@ function captains_log() {
vi -O $CLDIR/{$YESTERDAY,$TODAY,$TOMORROW}
if [ $GIT ]; then
if [ $GIT -ne 0 ]; then
echo Updating git...
if [ $( git -C "$CLDIR" status -s |wc -l) -ne 0 ]; then
git -C "$CLDIR" add -A
git -C "$CLDIR" commit -m "Audo-Commit by $(basename $0)"
git -C "$CLDIR" push
git -C "$CLDIR" add -Aq
git -C "$CLDIR" commit -qm "Auto-Commit by $(basename $0)"
git -C "$CLDIR" push -q
fi
fi
}

Loading…
Cancel
Save