aboutsummaryrefslogtreecommitdiff
path: root/todo
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-10-08 09:29:40 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-10-08 09:29:40 -0300
commitc516526728430aab6af7d8fe2200219b754023cd (patch)
tree7c4d4b33810443f71736f95de6dda8f9ccd2e23a /todo
parent1e62399a984f861e5c09105aeae93add96a4b313 (diff)
downloadscripts-c516526728430aab6af7d8fe2200219b754023cd.tar.gz
scripts-c516526728430aab6af7d8fe2200219b754023cd.tar.bz2
Filter support into TODO script
Diffstat (limited to 'todo')
-rwxr-xr-xtodo31
1 files changed, 23 insertions, 8 deletions
diff --git a/todo b/todo
index a4589c7..0543ca1 100755
--- a/todo
+++ b/todo
@@ -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>"