aboutsummaryrefslogtreecommitdiff
path: root/timelog
blob: f5d18a7ef344ee78ea03be3750e20364519fc8eb (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
#
# Worklog wrapper
#

BASE="$HOME/file"
GROUP="$1"
ACTION="$2"
BASENAME="`basename $0`"

if [ -z "$GROUP" ]; then
  echo "Usage: $BASENAME <group> [edit]"
  exit 1
fi

if [ -z "$EDITOR" ]; then
  EDITOR="vi"
fi

mkdir -p $BASE/$GROUP/worklog

if [ ! -e "$BASE/$GROUP/worklog/projects" ]; then
  cat > $BASE/$GROUP/worklog/projects <<EOF
# Worklog project file
# note that projects appear in Worklog in REVERSE order

#S:Sample project
#O:Other project
EOF

  echo "First run, you should edit your project list..."
  $EDITOR $BASE/$GROUP/worklog/projects
  ( cd $BASE/$GROUP/worklog && worklog )
elif [ "$ACTION" == "edit" ]; then
  $EDITOR $BASE/$GROUP/worklog/projects
else
  ( cd $BASE/$GROUP/worklog && worklog )
fi