]> gitweb.fluxo.info Git - scripts.git/commitdiff
Fix: todo script functionality
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 1 Jun 2024 07:10:00 +0000 (04:10 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 1 Jun 2024 07:10:00 +0000 (04:10 -0300)
todo

diff --git a/todo b/todo
index ba9127fa4db766d2838bd31b5f5f3fcdd0d38ad2..c51d2952d463bf127ba437457f894a395819be3b 100755 (executable)
--- a/todo
+++ b/todo
@@ -28,7 +28,7 @@ function todo_find {
 
     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
@@ -79,9 +79,13 @@ function todo_list {
       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 ""