diff options
-rwxr-xr-x | todo | 31 |
1 files changed, 23 insertions, 8 deletions
@@ -36,20 +36,33 @@ function todo_find { } function todo_list { + local status="$1" + todo_find | while read todo; do if [ "$todo" != "$NAME" ]; then - path="`echo $todo | sed -e "s|^$HOME|~|"`" - delim="===`echo $path | sed -e 's|.|=|g'`" - echo "" - echo In $path - echo $delim - echo "" - grep -e '*' -e '-' $todo + if [ ! -z "$status" ] && ! grep -q "\($status\)" $todo; then + continue + fi + + path="`echo $todo | sed -e "s|^$HOME|~|"`" + delim="===`echo $path | sed -e 's|.|=|g'`" + #echo "" + echo In $path + echo $delim + echo "" + + if [ ! -z "$status" ]; then + grep -e '*' -e '-' $todo | grep "\($status\)" + else + grep -e '*' -e '-' $todo + fi + + echo "" fi done } -if [ "$OPTION" == "list" ]; then +if [ "$OPTION" == "find" ]; then todo_find | grep -v -e "^$NAME$" | sed -e "s|^$HOME|~|" elif [ "$OPTION" == "count" ]; then todo_find | grep -v $NAME | wc -l @@ -61,6 +74,8 @@ elif [ "$OPTION" == "show" ]; then # Check also for FIXMEs fixmes $2 fi +elif [ "$OPTION" == "list" ]; then + todo_list $2 elif [ "$OPTION" == "help" ]; then echo "usage: $BASENAME [list|count]" echo " $BASENAME show <file>" |