Aligned "no such task" error message with verbose messages.

The message now also starts with "TODO:", like all other messages (except for the usage messages).
Before: 42: No such task.
After:  TODO: No task 42.
This commit is contained in:
Ingo Karkat
2010-07-15 13:48:24 +02:00
parent b383b1f0c5
commit 4d29e68e89
6 changed files with 13 additions and 13 deletions

View File

@@ -88,7 +88,7 @@ EOF
test_todo_session 'replace error' << EOF test_todo_session 'replace error' << EOF
>>> todo.sh replace 10 "hej!" >>> todo.sh replace 10 "hej!"
=== 1 === 1
10: No such task. TODO: No task 10.
EOF EOF
cat /dev/null > todo.txt cat /dev/null > todo.txt

View File

@@ -41,7 +41,7 @@ EOF
test_todo_session 'append error' << EOF test_todo_session 'append error' << EOF
>>> todo.sh append 10 "hej!" >>> todo.sh append 10 "hej!"
=== 1 === 1
10: No such task. TODO: No task 10.
EOF EOF
cat > todo.txt <<EOF cat > todo.txt <<EOF

View File

@@ -12,7 +12,7 @@ EOF
test_todo_session 'depriority nonexistant item' <<EOF test_todo_session 'depriority nonexistant item' <<EOF
>>> todo.sh depri 42 >>> todo.sh depri 42
42: No such task. TODO: No task 42.
=== 1 === 1
EOF EOF

View File

@@ -12,11 +12,11 @@ EOF
test_todo_session 'del nonexistant item' <<EOF test_todo_session 'del nonexistant item' <<EOF
>>> todo.sh -f del 42 >>> todo.sh -f del 42
42: No such task. TODO: No task 42.
=== 1 === 1
>>> todo.sh -f del 42 Roses >>> todo.sh -f del 42 Roses
42: No such task. TODO: No task 42.
=== 1 === 1
EOF EOF
@@ -55,7 +55,7 @@ test_todo_session 'del preserving line numbers' <<EOF
TODO: 1 deleted. TODO: 1 deleted.
>>> todo.sh -f del 1 >>> todo.sh -f del 1
1: No such task. TODO: No task 1.
=== 1 === 1
>>> todo.sh add A new task >>> todo.sh add A new task

View File

@@ -110,7 +110,7 @@ usage: todo.sh append ITEM# "TEXT TO APPEND"
TODO: 5 of 5 tasks shown TODO: 5 of 5 tasks shown
>>> todo.sh append 10 "hej!" >>> todo.sh append 10 "hej!"
10: No such task. TODO: No task 10.
=== 1 === 1
>>> todo.sh -p list >>> todo.sh -p list
@@ -123,7 +123,7 @@ TODO: 5 of 5 tasks shown
TODO: 5 of 5 tasks shown TODO: 5 of 5 tasks shown
>>> todo.sh do 10 >>> todo.sh do 10
10: No such task. TODO: No task 10.
=== 1 === 1
>>> todo.sh -p list >>> todo.sh -p list

10
todo.sh
View File

@@ -304,7 +304,7 @@ replaceOrPrepend()
[[ "$item" = +([0-9]) ]] || die "$errmsg" [[ "$item" = +([0-9]) ]] || die "$errmsg"
todo=$(sed "$item!d" "$TODO_FILE") todo=$(sed "$item!d" "$TODO_FILE")
[ -z "$todo" ] && die "$item: No such task." [ -z "$todo" ] && die "TODO: No task $item."
if [[ -z "$1" && $TODOTXT_FORCE = 0 ]]; then if [[ -z "$1" && $TODOTXT_FORCE = 0 ]]; then
echo -n "$querytext" echo -n "$querytext"
@@ -744,7 +744,7 @@ case $action in
[ -z "$item" ] && die "$errmsg" [ -z "$item" ] && die "$errmsg"
[[ "$item" = +([0-9]) ]] || die "$errmsg" [[ "$item" = +([0-9]) ]] || die "$errmsg"
todo=$(sed "$item!d" "$TODO_FILE") todo=$(sed "$item!d" "$TODO_FILE")
[ -z "$todo" ] && die "$item: No such task." [ -z "$todo" ] && die "TODO: No task $item."
if [[ -z "$1" && $TODOTXT_FORCE = 0 ]]; then if [[ -z "$1" && $TODOTXT_FORCE = 0 ]]; then
echo -n "Append: " echo -n "Append: "
read input read input
@@ -777,7 +777,7 @@ case $action in
[ -z "$item" ] && die "$errmsg" [ -z "$item" ] && die "$errmsg"
[[ "$item" = +([0-9]) ]] || die "$errmsg" [[ "$item" = +([0-9]) ]] || die "$errmsg"
DELETEME=$(sed "$item!d" "$TODO_FILE") DELETEME=$(sed "$item!d" "$TODO_FILE")
[ -z "$DELETEME" ] && die "$item: No such task." [ -z "$DELETEME" ] && die "TODO: No task $item."
if [ -z "$3" ]; then if [ -z "$3" ]; then
if [ $TODOTXT_FORCE = 0 ]; then if [ $TODOTXT_FORCE = 0 ]; then
@@ -832,7 +832,7 @@ case $action in
for item in `echo $* | tr ',' ' '`; do for item in `echo $* | tr ',' ' '`; do
[[ "$item" = +([0-9]) ]] || die "$errmsg" [[ "$item" = +([0-9]) ]] || die "$errmsg"
todo=$(sed "$item!d" "$TODO_FILE") todo=$(sed "$item!d" "$TODO_FILE")
[ -z "$todo" ] && die "$item: No such task." [ -z "$todo" ] && die "TODO: No task $item."
sed -e $item"s/^(.) //" "$TODO_FILE" > /dev/null 2>&1 sed -e $item"s/^(.) //" "$TODO_FILE" > /dev/null 2>&1
@@ -863,7 +863,7 @@ case $action in
[[ "$item" = +([0-9]) ]] || die "$errmsg" [[ "$item" = +([0-9]) ]] || die "$errmsg"
todo=$(sed "$item!d" "$TODO_FILE") todo=$(sed "$item!d" "$TODO_FILE")
[ -z "$todo" ] && die "$item: No such task." [ -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 [ `echo $todo | grep -c "^x "` -eq 0 ] ; then