--- -	2006-07-13 16:46:17.000000000 +0200
+++ /dev/fd/63	2006-07-13 16:46:17.000000000 +0200
@@ -119,6 +119,21 @@
 
 . "$CFG_FILE"
 
+thisweek=$(date '+%Y-%W')
+today=$(date '+%Y/%m/%d')
+thisyear=$(date '+%Y')
+CMD=$(echo $0 | sed 's/\(.*\)\///')
+
+
+if [[ $CMD != "manager" ]]; then
+	TODO_FILE="$TODO_DIR/list$CMD.txt"
+	DONE_FILE="$TODO_DIR/archive/$CMD/$thisweek.txt"  
+	REPORT_FILE="$TODO_DIR/archive/$CMD/report$thisyear.txt"
+	else
+		echo $0
+		echo $CMD
+	fi
+
 [ -z "$1" ]         && usage
 [ -d "$TODO_DIR" ]  || die "Fatal Error: $TODO_DIR is not a directory"  
 cd "$TODO_DIR"      || die "Fatal Error: Unable to cd to $TODO_DIR"
@@ -175,9 +190,9 @@
 	cleanup;;
 
 "archive" )
-	[[ $QUIET = 1 ]] || grep "^x " "$TODO_FILE"
-	grep "^x " "$TODO_FILE" >> "$DONE_FILE"
-	sed -i.bak '/^x /d' "$TODO_FILE"
+	[[ $QUIET = 1 ]] || grep "^x:done " "$TODO_FILE"
+	sed '/^x:done /!d' "$TODO_FILE" | sed 's/^x:done //' >> "$DONE_FILE"
+	sed -i.bak '/^x:done /d' "$TODO_FILE"
         [[ $QUIET = 1 ]] || echo "--"
         [[ $QUIET = 1 ]] || echo "TODO:  Items marked as done have been moved from $TODO_FILE to $DONE_FILE."
 	cleanup;;
@@ -209,8 +224,7 @@
 	[[ "$item" = +([0-9]) ]] || die "$errmsg"
 
 	if sed -ne "$item p" "$TODO_FILE" | grep "^."; then
-		now=`date '+%Y-%m-%d'`
-		sed -i.bak $2"s|^|&x $now |" "$TODO_FILE"
+		sed -i.bak $2"s|^|x:done &$today |" "$TODO_FILE"
 		NEWTODO=$(sed "$2!d" "$TODO_FILE")
 	        [[ $QUIET = 1 ]] || echo "$item: $NEWTODO"
 	        [[ $QUIET = 1 ]] || echo "TODO: $item marked as done."
@@ -223,13 +237,12 @@
 	item=$2
 	if [ -z "$item" ]; then
 		# Now in COLOR!  with padding!
-		echo -e "`sed = "$TODO_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1 /' | sed 's/^ /0/' | sort -k2 | sed 's/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed 's/\(.*(B).*\)/'$PRI_B'\1'$'/g' | sed 's/\(.*(C).*\)/'$PRI_C'\1'$'/g' | sed 's/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/g'`"
-
+		echo -e "`sed = "$TODO_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1 /' | sed 's/^ /0/' | sort -k2 | sed '/ x:done /!s/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*(B).*\)/'$PRI_B'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*(C).*\)/'$PRI_C'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/'`"
 		echo "--"
 		NUMTASKS=$(wc -l "$TODO_FILE" | sed 's/^[[:space:]]*\([0-9]*\).*/\1/')
 		echo "TODO: $NUMTASKS tasks in $TODO_FILE."
 	else
-		command=`sed = "$TODO_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1  /' | sed 's/^ /0/' | sort -k2 | sed 's/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed 's/\(.*(B).*\)/'$PRI_B'\1'$'/g' | sed 's/\(.*(C).*\)/'$PRI_C'\1'$'/g'  |  sed 's/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/g' | grep -i $item `
+		command=`sed = "$TODO_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1  /' | sed 's/^ /0/' | sort -k2 | sed '/ x:done /!s/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*(B).*\)/'$PRI_B'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*(C).*\)/'$PRI_C'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/' | grep -i $item `
 		shift
 		shift
 		for i in $*
@@ -245,9 +258,9 @@
 "listpri" )
 	pri=$2
 	if [ -z "$pri" ]; then
-		echo -e "`sed = "$TODO_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1  /' | sed 's/^ /0/' | sort -k2 |  sed 's/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed  's/\(.*(B).*\)/'$PRI_B'\1'$'/g' | sed 's/\(.*(C).*\)/'$PRI_C'\1'$'/g'  | sed 's/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/g'`" | grep \([A-Z]\)
+		echo -e "`sed = "$TODO_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1  /' | sed 's/^ /0/' | sort -k2 |  sed '/ x:done /!s/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*(B).*\)/'$PRI_B'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*(C).*\)/'$PRI_C'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/'`" | grep \([A-Z]\)
 	else
-		echo -e "`sed = "$TODO_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1  /' | sed 's/^ /0/' |  sort -k2 |  sed 's/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed  's/\(.*(B).*\)/'$PRI_B'\1'$'/g' | sed 's/\(.*(C).*\)/'$PRI_C'\1'$'/g'  | sed 's/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/g'`" | grep \($pri\)
+		echo -e "`sed = "$TODO_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1  /' | sed 's/^ /0/' |  sort -k2 |  sed '/ x:done /!s/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*(B).*\)/'$PRI_B'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*(C).*\)/'$PRI_C'\1'$DEFAULT'/g' | sed '/ x:done /!s/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/'`" | grep \($pri\)
 	fi
 	cleanup;;
 
@@ -320,8 +333,8 @@
 
 "report" )
 	#archive first
-	sed '/^x /!d' "$TODO_FILE" >> $DONE_FILE
-	sed -i.bak '/^x /d' "$TODO_FILE"
+	sed '/^x:done /!d' "$TODO_FILE" | sed 's/^x:done //' >> "$DONE_FILE"
+	sed -i.bak '/^x:done /d' "$TODO_FILE"
 
     NUMLINES=$(wc -l "$TODO_FILE" | sed 's/^[[:space:]]*\([0-9]*\).*/\1/')
     if [ $NUMLINES = "0" ]; then
