depri: Check for unprioritized task and print message.

The existing check didn't do much good, and one could deprioritize any normal task without notice. Instead, check that the task to be deprioritized actually has a priority and alert via "TODO: 42 is not prioritized." if that is not the case.
This commit is contained in:
Ingo Karkat
2011-05-10 11:52:38 +02:00
parent dae6f2bcaf
commit ddd3e9711b
2 changed files with 28 additions and 5 deletions

View File

@@ -921,10 +921,7 @@ case $action in
todo=$(sed "$item!d" "$TODO_FILE")
[ -z "$todo" ] && die "TODO: No task $item."
sed -e $item"s/^(.) //" "$TODO_FILE" > /dev/null 2>&1
if [ "$?" -eq 0 ]; then
#it's all good, continue
if sed "$item!d" "$TODO_FILE" | grep "^(.) " > /dev/null; then
sed -i.bak -e $item"s/^(.) //" "$TODO_FILE"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
NEWTODO=$(sed "$item!d" "$TODO_FILE")
@@ -932,7 +929,7 @@ case $action in
echo "TODO: $item deprioritized."
fi
else
die "$errmsg"
echo "TODO: $item is not prioritized."
fi
done
;;