#!/bin/bash
MINBASE=/usr/local/minerva
VARLOG=/var/log/minerva

date +"%F %H:%M CMD $0 $*" >>$VARLOG/bearskin/`basename $0`

CMD=$1; shift
USER=$1; shift
MSG=$*

TODOFILE=$MINBASE/etc/users/$USER/todolist

if [ "$CMD" == "init" ]; then
  echo >> $TODOFILE
fi

if [ "$CMD" == "add" ]; then
  date +"%Y-%m-%d $MSG" >> $TODOFILE
fi

if [ -f $TODOFILE ]; then
  if [ "$CMD" == "list" ]; then
    cat $TODOFILE
  elif [ "$CMD" == "clear" ]; then
    rm $TODOFILE
  fi
fi

