Bugfix: depri first checks validity of item argument syntax before searching for todo.

Added testcase for the basic depriority command.
This commit is contained in:
Ingo Karkat
2010-05-25 13:08:27 +02:00
parent 370abbbf36
commit 5876cc0437
2 changed files with 45 additions and 1 deletions

View File

@@ -745,9 +745,9 @@ case $action in
item=$2
errmsg="usage: $TODO_SH depri ITEM#"
[[ "$item" = +([0-9]) ]] || die "$errmsg"
todo=$(sed "$item!d" "$TODO_FILE")
[ -z "$todo" ] && die "$item: No such todo."
[[ "$item" = +([0-9]) ]] || die "$errmsg"
sed -e $item"s/^(.) //" "$TODO_FILE" > /dev/null 2>&1