aboutsummaryrefslogtreecommitdiff
path: root/ztd
blob: 7d3add871d1ec148568b4d60e568467ad1f67f3a (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
35
36
37
38
#!/bin/bash
#
# ZTD extension to commit, push and fetch a project.
#

# Parameters
PROJECT="$1"

# Try to get there
if [ ! -z "$PROJECT" ]; then
  cd $PROJECT &> /dev/null
elif ! git status &> /dev/null; then
  cd
  remind ~/.reminders | grep -v '^No reminders.$'
  status
  todo
  postponed

  if [ ! -z "`ls -1 ~/load/`" ]; then
    echo "Dangling files at ~/load:"
    echo ""
    ls -lh ~/load/
  fi

  exit
fi

# Sync
if git status &> /dev/null; then
  if which updates > /dev/null; then
    updates
  else
    git commit -a -m "Updates $PROJECT"
    git push
  fi

  git fetch --all
fi