# Extract done stuff from my to-do list, and keep a log of it.
if cd ~/Documents/Cloud
then
	typeset completed_message="### Completed $(date '+%Y-%m-%d %H:%M') ###"
	cloud sync
	tasks.py -f markdown -c -b -m "$completed_message" -s tasks.txt >> completed.txt
	typeset completed=$(now --all --width=80 --past-only --complete)
	if [[ -n "$completed" ]]
	then
		print
		print "$completed_message"
		print "$completed"
	fi >> completed.txt
	grep -v $'\\[[Xx]\\]' queue.txt > queue.tmp &&
		mv queue.tmp queue.txt
exit 1
	cloud sync -m "Completed tasks processed."
	cloud publish
fi

