BUG: pri doesn't issue error when task does not exist.

This commit is contained in:
Ingo Karkat
2011-12-17 21:29:18 +01:00
parent c0847b0b25
commit 55679d136f
2 changed files with 14 additions and 1 deletions

View File

@@ -1138,7 +1138,14 @@ note: PRIORITY must be anywhere from A to Z."
[[ "$item" = +([0-9]) ]] || die "$errmsg"
[[ "$newpri" = @([A-Z]) ]] || die "$errmsg"
oldpri=$(sed -ne $item's/^(\(.\)) .*/\1/p' "$TODO_FILE")
todo=$(sed "$item!d" "$TODO_FILE")
[ -z "$todo" ] && die "TODO: No task $item."
oldpri=
if [[ "$todo" = \(?\)\ * ]]; then
oldpri=${todo:1:1}
fi
if [ "$oldpri" != "$newpri" ]; then
sed -i.bak -e $item"s/^(.) //" -e $item"s/^/($newpri) /" "$TODO_FILE"
fi