Compare commits
1 Commits
archive/co
...
archive/si
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99dc4dce9f |
@@ -81,6 +81,6 @@ test_todo_session 'fail multiple do attempts' <<EOF
|
|||||||
TODO: 3 marked as done.
|
TODO: 3 marked as done.
|
||||||
|
|
||||||
>>> todo.sh -a do 3
|
>>> todo.sh -a do 3
|
||||||
TODO: 3 is already marked done.
|
3 is already marked done
|
||||||
EOF
|
EOF
|
||||||
test_done
|
test_done
|
||||||
|
|||||||
@@ -68,30 +68,4 @@ TODO: 2 deprioritized.
|
|||||||
TODO: 3 of 3 tasks shown
|
TODO: 3 of 3 tasks shown
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat > todo.txt <<EOF
|
|
||||||
(B) smell the uppercase Roses +flowers @outside
|
|
||||||
(A) notice the sunflowers
|
|
||||||
stop
|
|
||||||
EOF
|
|
||||||
test_todo_session 'depriority of unprioritized task' <<EOF
|
|
||||||
>>> todo.sh -p list
|
|
||||||
2 (A) notice the sunflowers
|
|
||||||
1 (B) smell the uppercase Roses +flowers @outside
|
|
||||||
3 stop
|
|
||||||
--
|
|
||||||
TODO: 3 of 3 tasks shown
|
|
||||||
|
|
||||||
>>> todo.sh depri 3 2
|
|
||||||
TODO: 3 is not prioritized.
|
|
||||||
2 notice the sunflowers
|
|
||||||
TODO: 2 deprioritized.
|
|
||||||
|
|
||||||
>>> todo.sh -p list
|
|
||||||
1 (B) smell the uppercase Roses +flowers @outside
|
|
||||||
2 notice the sunflowers
|
|
||||||
3 stop
|
|
||||||
--
|
|
||||||
TODO: 3 of 3 tasks shown
|
|
||||||
EOF
|
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|||||||
11
todo.sh
11
todo.sh
@@ -921,7 +921,10 @@ case $action in
|
|||||||
todo=$(sed "$item!d" "$TODO_FILE")
|
todo=$(sed "$item!d" "$TODO_FILE")
|
||||||
[ -z "$todo" ] && die "TODO: No task $item."
|
[ -z "$todo" ] && die "TODO: No task $item."
|
||||||
|
|
||||||
if sed "$item!d" "$TODO_FILE" | grep "^(.) " > /dev/null; then
|
sed -e $item"s/^(.) //" "$TODO_FILE" > /dev/null 2>&1
|
||||||
|
|
||||||
|
if [ "$?" -eq 0 ]; then
|
||||||
|
#it's all good, continue
|
||||||
sed -i.bak -e $item"s/^(.) //" "$TODO_FILE"
|
sed -i.bak -e $item"s/^(.) //" "$TODO_FILE"
|
||||||
if [ $TODOTXT_VERBOSE -gt 0 ]; then
|
if [ $TODOTXT_VERBOSE -gt 0 ]; then
|
||||||
NEWTODO=$(sed "$item!d" "$TODO_FILE")
|
NEWTODO=$(sed "$item!d" "$TODO_FILE")
|
||||||
@@ -929,7 +932,7 @@ case $action in
|
|||||||
echo "TODO: $item deprioritized."
|
echo "TODO: $item deprioritized."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "TODO: $item is not prioritized."
|
die "$errmsg"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
@@ -950,7 +953,7 @@ case $action in
|
|||||||
[ -z "$todo" ] && die "TODO: No task $item."
|
[ -z "$todo" ] && die "TODO: No task $item."
|
||||||
|
|
||||||
# Check if this item has already been done
|
# Check if this item has already been done
|
||||||
if [ `echo $todo | grep -c "^x "` -eq 0 ] ; then
|
if [ "${todo:0:2}" != "x " ]; then
|
||||||
now=`date '+%Y-%m-%d'`
|
now=`date '+%Y-%m-%d'`
|
||||||
# remove priority once item is done
|
# remove priority once item is done
|
||||||
sed -i.bak $item"s/^(.) //" "$TODO_FILE"
|
sed -i.bak $item"s/^(.) //" "$TODO_FILE"
|
||||||
@@ -961,7 +964,7 @@ case $action in
|
|||||||
echo "TODO: $item marked as done."
|
echo "TODO: $item marked as done."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "TODO: $item is already marked done."
|
echo "$item is already marked done"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user