find $folder/ -maxdepth $TODO_MAXDEPTH -xtype f -iname 'todo*' | while read todo; do
# Ignore lists without tasks
- if grep -q -e '* [ ]' -e '-' $todo; then
+ if grep -q -e '\* \[ \]' -e '-' $todo; then
echo $todo
fi
done
echo ""
if [ ! -z "$status" ]; then
- grep -e '* [ ]' -e '-' $todo | grep "\($status\)"
+ if echo $todo | grep -q $status; then
+ grep -e '\* \[ \]' -e '-' $todo
+ else
+ grep -e '\* \[ \]' -e '-' $todo | grep "\($status\)"
+ fi
else
- grep -e '* [ ]' -e '-' $todo
+ grep -e '\* \[ \]' -e '-' $todo
fi
echo ""