Aligned verbose message output of tasks with normal task output.

I.e. removed the colon after the ITEM#. Updated tasks are now listed like the 'todo.sh ls' command does, e.g.
    42 smell the roses
This is in preparation to eventually use a function factored out from _list() for the verbose task output, which would enable coloring in the verbose message and thus align the verbose message output even more with the normal task output.
This commit is contained in:
Ingo Karkat
2010-07-14 18:01:39 +02:00
parent 8a95a66749
commit b383b1f0c5
14 changed files with 118 additions and 118 deletions

View File

@@ -12,7 +12,7 @@ command work, including support for filtering.
# #
test_todo_session 'basic add/list' <<EOF test_todo_session 'basic add/list' <<EOF
>>> todo.sh add notice the daisies >>> todo.sh add notice the daisies
1: notice the daisies 1 notice the daisies
TODO: 1 added. TODO: 1 added.
>>> todo.sh list >>> todo.sh list
@@ -21,7 +21,7 @@ TODO: 1 added.
TODO: 1 of 1 tasks shown TODO: 1 of 1 tasks shown
>>> todo.sh add smell the roses >>> todo.sh add smell the roses
2: smell the roses 2 smell the roses
TODO: 2 added. TODO: 2 added.
>>> todo.sh list >>> todo.sh list
@@ -48,7 +48,7 @@ EOF
test_todo_session 'case-insensitive filtering' <<EOF test_todo_session 'case-insensitive filtering' <<EOF
>>> todo.sh add smell the uppercase Roses >>> todo.sh add smell the uppercase Roses
3: smell the uppercase Roses 3 smell the uppercase Roses
TODO: 3 added. TODO: 3 added.
>>> todo.sh list roses >>> todo.sh list roses
@@ -60,7 +60,7 @@ EOF
test_todo_session 'add with &' <<EOF test_todo_session 'add with &' <<EOF
>>> todo.sh add "dig the garden & water the flowers" >>> todo.sh add "dig the garden & water the flowers"
4: dig the garden & water the flowers 4 dig the garden & water the flowers
TODO: 4 added. TODO: 4 added.
>>> todo.sh list >>> todo.sh list

View File

@@ -12,7 +12,7 @@ a date to each item.
# #
test_todo_session 'cmd line first day' <<EOF test_todo_session 'cmd line first day' <<EOF
>>> todo.sh -t add notice the daisies >>> todo.sh -t add notice the daisies
1: 2009-02-13 notice the daisies 1 2009-02-13 notice the daisies
TODO: 1 added. TODO: 1 added.
>>> todo.sh list >>> todo.sh list
@@ -25,7 +25,7 @@ test_tick
test_todo_session 'cmd line second day' <<EOF test_todo_session 'cmd line second day' <<EOF
>>> todo.sh -t add smell the roses >>> todo.sh -t add smell the roses
2: 2009-02-14 smell the roses 2 2009-02-14 smell the roses
TODO: 2 added. TODO: 2 added.
>>> todo.sh list >>> todo.sh list
@@ -39,7 +39,7 @@ test_tick
test_todo_session 'cmd line third day' <<EOF test_todo_session 'cmd line third day' <<EOF
>>> todo.sh -t add mow the lawn >>> todo.sh -t add mow the lawn
3: 2009-02-15 mow the lawn 3 2009-02-15 mow the lawn
TODO: 3 added. TODO: 3 added.
>>> todo.sh list >>> todo.sh list
@@ -58,7 +58,7 @@ test_tick 3600
test_todo_session 'config file third day' <<EOF test_todo_session 'config file third day' <<EOF
>>> todo.sh add take out the trash >>> todo.sh add take out the trash
4: 2009-02-15 take out the trash 4 2009-02-15 take out the trash
TODO: 4 added. TODO: 4 added.
>>> todo.sh list >>> todo.sh list

View File

@@ -20,7 +20,7 @@ touch "$HOME/garden.txt"
test_todo_session 'basic addto/listfile' <<EOF test_todo_session 'basic addto/listfile' <<EOF
>>> todo.sh addto garden.txt notice the daisies >>> todo.sh addto garden.txt notice the daisies
1: notice the daisies 1 notice the daisies
GARDEN: 1 added. GARDEN: 1 added.
>>> todo.sh listfile garden.txt >>> todo.sh listfile garden.txt
@@ -29,7 +29,7 @@ GARDEN: 1 added.
GARDEN: 1 of 1 tasks shown GARDEN: 1 of 1 tasks shown
>>> todo.sh addto garden.txt smell the roses >>> todo.sh addto garden.txt smell the roses
2: smell the roses 2 smell the roses
GARDEN: 2 added. GARDEN: 2 added.
>>> todo.sh listfile garden.txt >>> todo.sh listfile garden.txt
@@ -56,7 +56,7 @@ EOF
test_todo_session 'case-insensitive filtering' <<EOF test_todo_session 'case-insensitive filtering' <<EOF
>>> todo.sh addto garden.txt smell the uppercase Roses >>> todo.sh addto garden.txt smell the uppercase Roses
3: smell the uppercase Roses 3 smell the uppercase Roses
GARDEN: 3 added. GARDEN: 3 added.
>>> todo.sh listfile garden.txt roses >>> todo.sh listfile garden.txt roses
@@ -68,7 +68,7 @@ EOF
test_todo_session 'addto with &' <<EOF test_todo_session 'addto with &' <<EOF
>>> todo.sh addto garden.txt "dig the garden & water the flowers" >>> todo.sh addto garden.txt "dig the garden & water the flowers"
4: dig the garden & water the flowers 4 dig the garden & water the flowers
GARDEN: 4 added. GARDEN: 4 added.
>>> todo.sh listfile garden.txt >>> todo.sh listfile garden.txt

View File

@@ -14,7 +14,7 @@ touch "$HOME/garden.txt"
# #
test_todo_session 'cmd line first day' <<EOF test_todo_session 'cmd line first day' <<EOF
>>> todo.sh -t addto garden.txt notice the daisies >>> todo.sh -t addto garden.txt notice the daisies
1: 2009-02-13 notice the daisies 1 2009-02-13 notice the daisies
GARDEN: 1 added. GARDEN: 1 added.
>>> todo.sh listfile garden.txt >>> todo.sh listfile garden.txt
@@ -27,7 +27,7 @@ test_tick
test_todo_session 'cmd line second day' <<EOF test_todo_session 'cmd line second day' <<EOF
>>> todo.sh -t addto garden.txt smell the roses >>> todo.sh -t addto garden.txt smell the roses
2: 2009-02-14 smell the roses 2 2009-02-14 smell the roses
GARDEN: 2 added. GARDEN: 2 added.
>>> todo.sh listfile garden.txt >>> todo.sh listfile garden.txt
@@ -41,7 +41,7 @@ test_tick
test_todo_session 'cmd line third day' <<EOF test_todo_session 'cmd line third day' <<EOF
>>> todo.sh -t addto garden.txt mow the lawn >>> todo.sh -t addto garden.txt mow the lawn
3: 2009-02-15 mow the lawn 3 2009-02-15 mow the lawn
GARDEN: 3 added. GARDEN: 3 added.
>>> todo.sh listfile garden.txt >>> todo.sh listfile garden.txt
@@ -60,7 +60,7 @@ test_tick 3600
test_todo_session 'config file third day' <<EOF test_todo_session 'config file third day' <<EOF
>>> todo.sh addto garden.txt take out the trash >>> todo.sh addto garden.txt take out the trash
4: 2009-02-15 take out the trash 4 2009-02-15 take out the trash
GARDEN: 4 added. GARDEN: 4 added.
>>> todo.sh listfile garden.txt >>> todo.sh listfile garden.txt

View File

@@ -19,9 +19,9 @@ EOF
test_todo_session 'basic replace' <<EOF test_todo_session 'basic replace' <<EOF
>>> todo.sh replace 1 "smell the cows" >>> todo.sh replace 1 "smell the cows"
1: notice the daisies 1 notice the daisies
TODO: Replaced task with: TODO: Replaced task with:
1: smell the cows 1 smell the cows
>>> todo.sh list >>> todo.sh list
1 smell the cows 1 smell the cows
@@ -29,9 +29,9 @@ TODO: Replaced task with:
TODO: 1 of 1 tasks shown TODO: 1 of 1 tasks shown
>>> todo.sh replace 1 smell the roses >>> todo.sh replace 1 smell the roses
1: smell the cows 1 smell the cows
TODO: Replaced task with: TODO: Replaced task with:
1: smell the roses 1 smell the roses
>>> todo.sh list >>> todo.sh list
1 smell the roses 1 smell the roses
@@ -47,42 +47,42 @@ chase the chickens
EOF EOF
test_todo_session 'replace in multi-item file' <<EOF test_todo_session 'replace in multi-item file' <<EOF
>>> todo.sh replace 1 smell the cheese >>> todo.sh replace 1 smell the cheese
1: smell the cows 1 smell the cows
TODO: Replaced task with: TODO: Replaced task with:
1: smell the cheese 1 smell the cheese
>>> todo.sh replace 3 jump on hay >>> todo.sh replace 3 jump on hay
3: thrash some hay 3 thrash some hay
TODO: Replaced task with: TODO: Replaced task with:
3: jump on hay 3 jump on hay
>>> todo.sh replace 4 collect the eggs >>> todo.sh replace 4 collect the eggs
4: chase the chickens 4 chase the chickens
TODO: Replaced task with: TODO: Replaced task with:
4: collect the eggs 4 collect the eggs
EOF EOF
test_todo_session 'replace with priority' <<EOF test_todo_session 'replace with priority' <<EOF
>>> todo.sh pri 4 a >>> todo.sh pri 4 a
4: (A) collect the eggs 4 (A) collect the eggs
TODO: 4 prioritized (A). TODO: 4 prioritized (A).
>>> todo.sh replace 4 "collect the bread" >>> todo.sh replace 4 "collect the bread"
4: (A) collect the eggs 4 (A) collect the eggs
TODO: Replaced task with: TODO: Replaced task with:
4: (A) collect the bread 4 (A) collect the bread
>>> todo.sh replace 4 collect the eggs >>> todo.sh replace 4 collect the eggs
4: (A) collect the bread 4 (A) collect the bread
TODO: Replaced task with: TODO: Replaced task with:
4: (A) collect the eggs 4 (A) collect the eggs
EOF EOF
test_todo_session 'replace with &' << EOF test_todo_session 'replace with &' << EOF
>>> todo.sh replace 3 "thrash the hay & thresh the wheat" >>> todo.sh replace 3 "thrash the hay & thresh the wheat"
3: jump on hay 3 jump on hay
TODO: Replaced task with: TODO: Replaced task with:
3: thrash the hay & thresh the wheat 3 thrash the hay & thresh the wheat
EOF EOF
test_todo_session 'replace error' << EOF test_todo_session 'replace error' << EOF
@@ -94,41 +94,41 @@ EOF
cat /dev/null > todo.txt cat /dev/null > todo.txt
test_todo_session 'replace handling prepended date on add' <<EOF test_todo_session 'replace handling prepended date on add' <<EOF
>>> todo.sh -t add "new task" >>> todo.sh -t add "new task"
1: 2009-02-13 new task 1 2009-02-13 new task
TODO: 1 added. TODO: 1 added.
>>> todo.sh replace 1 this is just a new one >>> todo.sh replace 1 this is just a new one
1: 2009-02-13 new task 1 2009-02-13 new task
TODO: Replaced task with: TODO: Replaced task with:
1: 2009-02-13 this is just a new one 1 2009-02-13 this is just a new one
>>> todo.sh replace 1 2010-07-04 this also has a new date >>> todo.sh replace 1 2010-07-04 this also has a new date
1: 2009-02-13 this is just a new one 1 2009-02-13 this is just a new one
TODO: Replaced task with: TODO: Replaced task with:
1: 2010-07-04 this also has a new date 1 2010-07-04 this also has a new date
EOF EOF
cat /dev/null > todo.txt cat /dev/null > todo.txt
test_todo_session 'replace handling priority and prepended date on add' <<EOF test_todo_session 'replace handling priority and prepended date on add' <<EOF
>>> todo.sh -t add "new task" >>> todo.sh -t add "new task"
1: 2009-02-13 new task 1 2009-02-13 new task
TODO: 1 added. TODO: 1 added.
>>> todo.sh pri 1 A >>> todo.sh pri 1 A
1: (A) 2009-02-13 new task 1 (A) 2009-02-13 new task
TODO: 1 prioritized (A). TODO: 1 prioritized (A).
>>> todo.sh replace 1 this is just a new one >>> todo.sh replace 1 this is just a new one
1: (A) 2009-02-13 new task 1 (A) 2009-02-13 new task
TODO: Replaced task with: TODO: Replaced task with:
1: (A) 2009-02-13 this is just a new one 1 (A) 2009-02-13 this is just a new one
EOF EOF
test_todo_session 'replace with prepended date replaces existing date' <<EOF test_todo_session 'replace with prepended date replaces existing date' <<EOF
>>> todo.sh replace 1 2010-07-04 this also has a new date >>> todo.sh replace 1 2010-07-04 this also has a new date
1: (A) 2009-02-13 this is just a new one 1 (A) 2009-02-13 this is just a new one
TODO: Replaced task with: TODO: Replaced task with:
1: (A) 2010-07-04 this also has a new date 1 (A) 2010-07-04 this also has a new date
EOF EOF
test_done test_done

View File

@@ -25,7 +25,7 @@ test_todo_session 'basic priority' <<EOF
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh pri 1 B >>> todo.sh pri 1 B
1: (B) smell the uppercase Roses +flowers @outside 1 (B) smell the uppercase Roses +flowers @outside
TODO: 1 prioritized (B). TODO: 1 prioritized (B).
>>> todo.sh list >>> todo.sh list
@@ -43,7 +43,7 @@ TODO: 3 of 3 tasks shown
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh pri 2 C >>> todo.sh pri 2 C
2: (C) notice the sunflowers 2 (C) notice the sunflowers
TODO: 2 prioritized (C). TODO: 2 prioritized (C).
>>> todo.sh -p list >>> todo.sh -p list
@@ -54,7 +54,7 @@ TODO: 2 prioritized (C).
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh pri 2 A >>> todo.sh pri 2 A
2: (A) notice the sunflowers 2 (A) notice the sunflowers
TODO: 2 prioritized (A). TODO: 2 prioritized (A).
>>> todo.sh -p list >>> todo.sh -p list
@@ -65,7 +65,7 @@ TODO: 2 prioritized (A).
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh pri 2 a >>> todo.sh pri 2 a
2: (A) notice the sunflowers 2 (A) notice the sunflowers
TODO: 2 prioritized (A). TODO: 2 prioritized (A).
>>> todo.sh -p listpri >>> todo.sh -p listpri
@@ -75,7 +75,7 @@ TODO: 2 prioritized (A).
TODO: 2 of 3 tasks shown TODO: 2 of 3 tasks shown
>>> todo.sh add "smell the coffee +wakeup" >>> todo.sh add "smell the coffee +wakeup"
4: smell the coffee +wakeup 4 smell the coffee +wakeup
TODO: 4 added. TODO: 4 added.
>>> todo.sh -p list >>> todo.sh -p list

View File

@@ -31,7 +31,7 @@ TODO: 3 of 3 tasks shown
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh prepend 2 test >>> todo.sh prepend 2 test
2: test notice the sunflowers 2 test notice the sunflowers
>>> todo.sh -p list >>> todo.sh -p list
1 (B) smell the uppercase Roses +flowers @outside 1 (B) smell the uppercase Roses +flowers @outside
@@ -41,7 +41,7 @@ TODO: 3 of 3 tasks shown
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh prepend 1 test >>> todo.sh prepend 1 test
1: (B) test smell the uppercase Roses +flowers @outside 1 (B) test smell the uppercase Roses +flowers @outside
>>> todo.sh -p list >>> todo.sh -p list
1 (B) test smell the uppercase Roses +flowers @outside 1 (B) test smell the uppercase Roses +flowers @outside
@@ -54,41 +54,41 @@ EOF
test_todo_session 'prepend with &' <<EOF test_todo_session 'prepend with &' <<EOF
>>> todo.sh prepend 3 "no running & jumping now" >>> todo.sh prepend 3 "no running & jumping now"
3: no running & jumping now stop 3 no running & jumping now stop
EOF EOF
cat /dev/null > todo.txt cat /dev/null > todo.txt
test_todo_session 'prepend handling prepended date on add' <<EOF test_todo_session 'prepend handling prepended date on add' <<EOF
>>> todo.sh -t add "new task" >>> todo.sh -t add "new task"
1: 2009-02-13 new task 1 2009-02-13 new task
TODO: 1 added. TODO: 1 added.
>>> todo.sh prepend 1 "this is just a" >>> todo.sh prepend 1 "this is just a"
1: 2009-02-13 this is just a new task 1 2009-02-13 this is just a new task
EOF EOF
cat /dev/null > todo.txt cat /dev/null > todo.txt
test_todo_session 'prepend handling priority and prepended date on add' <<EOF test_todo_session 'prepend handling priority and prepended date on add' <<EOF
>>> todo.sh -t add "new task" >>> todo.sh -t add "new task"
1: 2009-02-13 new task 1 2009-02-13 new task
TODO: 1 added. TODO: 1 added.
>>> todo.sh pri 1 A >>> todo.sh pri 1 A
1: (A) 2009-02-13 new task 1 (A) 2009-02-13 new task
TODO: 1 prioritized (A). TODO: 1 prioritized (A).
>>> todo.sh prepend 1 "this is just a" >>> todo.sh prepend 1 "this is just a"
1: (A) 2009-02-13 this is just a new task 1 (A) 2009-02-13 this is just a new task
EOF EOF
cat /dev/null > todo.txt cat /dev/null > todo.txt
test_todo_session 'prepend with prepended date keeps both' <<EOF test_todo_session 'prepend with prepended date keeps both' <<EOF
>>> todo.sh -t add "new task" >>> todo.sh -t add "new task"
1: 2009-02-13 new task 1 2009-02-13 new task
TODO: 1 added. TODO: 1 added.
>>> todo.sh prepend 1 "2010-07-04 this is just a" >>> todo.sh prepend 1 "2010-07-04 this is just a"
1: 2009-02-13 2010-07-04 this is just a new task 1 2009-02-13 2010-07-04 this is just a new task
EOF EOF
test_done test_done

View File

@@ -41,9 +41,9 @@ test_todo_session 'basic do' <<EOF
TODO: 7 of 7 tasks shown TODO: 7 of 7 tasks shown
>>> todo.sh do 7,6 >>> todo.sh do 7,6
7: x 2009-02-13 remove4 7 x 2009-02-13 remove4
TODO: 7 marked as done. TODO: 7 marked as done.
6: x 2009-02-13 remove3 6 x 2009-02-13 remove3
TODO: 6 marked as done. TODO: 6 marked as done.
x 2009-02-13 remove3 x 2009-02-13 remove3
x 2009-02-13 remove4 x 2009-02-13 remove4
@@ -59,9 +59,9 @@ TODO: $HOME/todo.txt archived.
TODO: 5 of 5 tasks shown TODO: 5 of 5 tasks shown
>>> todo.sh do 5 4 >>> todo.sh do 5 4
5: x 2009-02-13 remove2 5 x 2009-02-13 remove2
TODO: 5 marked as done. TODO: 5 marked as done.
4: x 2009-02-13 remove1 4 x 2009-02-13 remove1
TODO: 4 marked as done. TODO: 4 marked as done.
x 2009-02-13 remove1 x 2009-02-13 remove1
x 2009-02-13 remove2 x 2009-02-13 remove2
@@ -77,7 +77,7 @@ EOF
test_todo_session 'fail multiple do attempts' <<EOF test_todo_session 'fail multiple do attempts' <<EOF
>>> todo.sh -a do 3 >>> todo.sh -a do 3
3: x 2009-02-13 stop 3 x 2009-02-13 stop
TODO: 3 marked as done. TODO: 3 marked as done.
>>> todo.sh -a do 3 >>> todo.sh -a do 3

View File

@@ -19,7 +19,7 @@ EOF
test_todo_session 'basic append' <<EOF test_todo_session 'basic append' <<EOF
>>> todo.sh append 1 "smell the roses" >>> todo.sh append 1 "smell the roses"
1: notice the daisies smell the roses 1 notice the daisies smell the roses
>>> todo.sh list >>> todo.sh list
1 notice the daisies smell the roses 1 notice the daisies smell the roses
@@ -29,7 +29,7 @@ EOF
test_todo_session 'basic append with &' <<EOF test_todo_session 'basic append with &' <<EOF
>>> todo.sh append 1 "see the wasps & bees" >>> todo.sh append 1 "see the wasps & bees"
1: notice the daisies smell the roses see the wasps & bees 1 notice the daisies smell the roses see the wasps & bees
>>> todo.sh list >>> todo.sh list
1 notice the daisies smell the roses see the wasps & bees 1 notice the daisies smell the roses see the wasps & bees
@@ -49,13 +49,13 @@ notice the daisies
EOF EOF
test_todo_session 'append of current sentence' <<EOF test_todo_session 'append of current sentence' <<EOF
>>> todo.sh append 1 ", lilies and roses" >>> todo.sh append 1 ", lilies and roses"
1: notice the daisies, lilies and roses 1 notice the daisies, lilies and roses
>>> todo.sh append 1 "; see the wasps" >>> todo.sh append 1 "; see the wasps"
1: notice the daisies, lilies and roses; see the wasps 1 notice the daisies, lilies and roses; see the wasps
>>> todo.sh append 1 "& bees" >>> todo.sh append 1 "& bees"
1: notice the daisies, lilies and roses; see the wasps & bees 1 notice the daisies, lilies and roses; see the wasps & bees
EOF EOF
cp todo.cfg special-delimiters.cfg cp todo.cfg special-delimiters.cfg
@@ -64,13 +64,13 @@ export SENTENCE_DELIMITERS='*,.:;&'
EOF EOF
test_todo_session 'append of current sentence SENTENCE_DELIMITERS' <<EOF test_todo_session 'append of current sentence SENTENCE_DELIMITERS' <<EOF
>>> todo.sh -d special-delimiters.cfg append 1 "&beans" >>> todo.sh -d special-delimiters.cfg append 1 "&beans"
1: notice the daisies, lilies and roses; see the wasps & bees&beans 1 notice the daisies, lilies and roses; see the wasps & bees&beans
>>> todo.sh -d special-delimiters.cfg append 1 "%foo" >>> todo.sh -d special-delimiters.cfg append 1 "%foo"
1: notice the daisies, lilies and roses; see the wasps & bees&beans %foo 1 notice the daisies, lilies and roses; see the wasps & bees&beans %foo
>>> todo.sh -d special-delimiters.cfg append 1 "*2" >>> todo.sh -d special-delimiters.cfg append 1 "*2"
1: notice the daisies, lilies and roses; see the wasps & bees&beans %foo*2 1 notice the daisies, lilies and roses; see the wasps & bees&beans %foo*2
EOF EOF
test_done test_done

View File

@@ -30,7 +30,7 @@ test_todo_session 'basic depriority' <<EOF
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh depri 1 >>> todo.sh depri 1
1: smell the uppercase Roses +flowers @outside 1 smell the uppercase Roses +flowers @outside
TODO: 1 deprioritized. TODO: 1 deprioritized.
>>> todo.sh -p list >>> todo.sh -p list
@@ -55,9 +55,9 @@ test_todo_session 'multiple depriority' <<EOF
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh depri 3 2 >>> todo.sh depri 3 2
3: stop 3 stop
TODO: 3 deprioritized. TODO: 3 deprioritized.
2: notice the sunflowers 2 notice the sunflowers
TODO: 2 deprioritized. TODO: 2 deprioritized.
>>> todo.sh -p list >>> todo.sh -p list

View File

@@ -34,7 +34,7 @@ test_todo_session 'basic del' <<EOF
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh -f del 1 >>> todo.sh -f del 1
1: (B) smell the uppercase Roses +flowers @outside 1 (B) smell the uppercase Roses +flowers @outside
TODO: 1 deleted. TODO: 1 deleted.
>>> todo.sh -p list >>> todo.sh -p list
@@ -51,7 +51,7 @@ stop
EOF EOF
test_todo_session 'del preserving line numbers' <<EOF test_todo_session 'del preserving line numbers' <<EOF
>>> todo.sh -f del 1 >>> todo.sh -f del 1
1: (B) smell the uppercase Roses +flowers @outside 1 (B) smell the uppercase Roses +flowers @outside
TODO: 1 deleted. TODO: 1 deleted.
>>> todo.sh -f del 1 >>> todo.sh -f del 1
@@ -59,7 +59,7 @@ TODO: 1 deleted.
=== 1 === 1
>>> todo.sh add A new task >>> todo.sh add A new task
4: A new task 4 A new task
TODO: 4 added. TODO: 4 added.
>>> todo.sh -p list >>> todo.sh -p list
@@ -70,11 +70,11 @@ TODO: 4 added.
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh -f -n del 2 >>> todo.sh -f -n del 2
2: (A) notice the sunflowers 2 (A) notice the sunflowers
TODO: 2 deleted. TODO: 2 deleted.
>>> todo.sh add Another new task >>> todo.sh add Another new task
3: Another new task 3 Another new task
TODO: 3 added. TODO: 3 added.
>>> todo.sh -p list >>> todo.sh -p list
@@ -99,9 +99,9 @@ test_todo_session 'basic del TERM' <<EOF
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh del 1 uppercase >>> todo.sh del 1 uppercase
1: (B) smell the uppercase Roses +flowers @outside 1 (B) smell the uppercase Roses +flowers @outside
TODO: Removed 'uppercase' from task. TODO: Removed 'uppercase' from task.
1: (B) smell the Roses +flowers @outside 1 (B) smell the Roses +flowers @outside
>>> todo.sh -p list >>> todo.sh -p list
2 (A) notice the sunflowers 2 (A) notice the sunflowers
@@ -111,24 +111,24 @@ TODO: Removed 'uppercase' from task.
TODO: 3 of 3 tasks shown TODO: 3 of 3 tasks shown
>>> todo.sh del 1 "the Roses" >>> todo.sh del 1 "the Roses"
1: (B) smell the Roses +flowers @outside 1 (B) smell the Roses +flowers @outside
TODO: Removed 'the Roses' from task. TODO: Removed 'the Roses' from task.
1: (B) smell +flowers @outside 1 (B) smell +flowers @outside
>>> todo.sh del 1 m >>> todo.sh del 1 m
1: (B) smell +flowers @outside 1 (B) smell +flowers @outside
TODO: Removed 'm' from task. TODO: Removed 'm' from task.
1: (B) sell +flowers @outside 1 (B) sell +flowers @outside
>>> todo.sh del 1 @outside >>> todo.sh del 1 @outside
1: (B) sell +flowers @outside 1 (B) sell +flowers @outside
TODO: Removed '@outside' from task. TODO: Removed '@outside' from task.
1: (B) sell +flowers 1 (B) sell +flowers
>>> todo.sh del 1 sell >>> todo.sh del 1 sell
1: (B) sell +flowers 1 (B) sell +flowers
TODO: Removed 'sell' from task. TODO: Removed 'sell' from task.
1: (B) +flowers 1 (B) +flowers
EOF EOF
cat > todo.txt <<EOF cat > todo.txt <<EOF
@@ -138,7 +138,7 @@ cat > todo.txt <<EOF
EOF EOF
test_todo_session 'del nonexistant TERM' <<EOF test_todo_session 'del nonexistant TERM' <<EOF
>>> todo.sh del 1 dung >>> todo.sh del 1 dung
1: (B) smell the uppercase Roses +flowers @outside 1 (B) smell the uppercase Roses +flowers @outside
TODO: 'dung' not found; no removal done. TODO: 'dung' not found; no removal done.
=== 1 === 1

View File

@@ -6,9 +6,9 @@ test_description='Multi-line functionality'
## Replace test ## Replace test
# Create the expected file # Create the expected file
echo "1: smell the cheese echo "1 smell the cheese
TODO: Replaced task with: TODO: Replaced task with:
1: eat apples eat oranges drink milk">$HOME/expect.multi 1 eat apples eat oranges drink milk">$HOME/expect.multi
test_expect_success 'multiline squash item replace' ' test_expect_success 'multiline squash item replace' '
( (
@@ -33,7 +33,7 @@ fi
## Add test ## Add test
# Create the expected file # Create the expected file
echo "2: eat apples eat oranges drink milk echo "2 eat apples eat oranges drink milk
TODO: 2 added.">$HOME/expect.multi TODO: 2 added.">$HOME/expect.multi
test_expect_success 'multiline squash item add' ' test_expect_success 'multiline squash item add' '
@@ -59,7 +59,7 @@ fi
## Append test ## Append test
# Create the expected file # Create the expected file
echo "1: smell the cheese eat apples eat oranges drink milk">$HOME/expect.multi echo "1 smell the cheese eat apples eat oranges drink milk">$HOME/expect.multi
test_expect_success 'multiline squash item append' ' test_expect_success 'multiline squash item append' '
( (
@@ -84,7 +84,7 @@ fi
## Prepend test ## Prepend test
# Create the expected file # Create the expected file
echo "1: eat apples eat oranges drink milk smell the cheese">$HOME/expect.multi echo "1 eat apples eat oranges drink milk smell the cheese">$HOME/expect.multi
test_expect_success 'multiline squash item prepend' ' test_expect_success 'multiline squash item prepend' '
( (
@@ -109,11 +109,11 @@ fi
## Multiple line addition ## Multiple line addition
# Create the expected file # Create the expected file
echo "2: eat apples echo "2 eat apples
TODO: 2 added." > $HOME/expect.multi TODO: 2 added." > $HOME/expect.multi
echo "3: eat oranges echo "3 eat oranges
TODO: 3 added." >>$HOME/expect.multi TODO: 3 added." >>$HOME/expect.multi
echo "4: drink milk echo "4 drink milk
TODO: 4 added." >> $HOME/expect.multi TODO: 4 added." >> $HOME/expect.multi
test_expect_success 'actual multiline add' ' test_expect_success 'actual multiline add' '

View File

@@ -36,7 +36,7 @@ TODO: 2 of 4 tasks shown
TODO: 1 of 4 tasks shown TODO: 1 of 4 tasks shown
>>> todo.sh -a do 2 >>> todo.sh -a do 2
2: x 2009-02-13 notice the sunflowers 2 x 2009-02-13 notice the sunflowers
TODO: 2 marked as done. TODO: 2 marked as done.
>>> todo.sh -p list >>> todo.sh -p list
@@ -48,7 +48,7 @@ TODO: 2 marked as done.
TODO: 4 of 4 tasks shown TODO: 4 of 4 tasks shown
>>> todo.sh add "make the coffee +wakeup" >>> todo.sh add "make the coffee +wakeup"
5: make the coffee +wakeup 5 make the coffee +wakeup
TODO: 5 added. TODO: 5 added.
>>> todo.sh -p list coffee >>> todo.sh -p list coffee
@@ -58,7 +58,7 @@ TODO: 5 added.
TODO: 2 of 5 tasks shown TODO: 2 of 5 tasks shown
>>> todo.sh add "visit http://example.com" >>> todo.sh add "visit http://example.com"
6: visit http://example.com 6 visit http://example.com
TODO: 6 added. TODO: 6 added.
>>> todo.sh -p list >>> todo.sh -p list
@@ -98,7 +98,7 @@ usage: todo.sh append ITEM# "TEXT TO APPEND"
=== 1 === 1
>>> todo.sh append 2 and think >>> todo.sh append 2 and think
2: stop and think 2 stop and think
>>> todo.sh -p list >>> todo.sh -p list
1 (B) smell the uppercase Roses +flowers @outside 1 (B) smell the uppercase Roses +flowers @outside
@@ -136,7 +136,7 @@ TODO: 5 of 5 tasks shown
TODO: 5 of 5 tasks shown TODO: 5 of 5 tasks shown
>>> todo.sh add "the coffee +wakeup" >>> todo.sh add "the coffee +wakeup"
6: the coffee +wakeup 6 the coffee +wakeup
TODO: 6 added. TODO: 6 added.
>>> todo.sh -p list >>> todo.sh -p list
@@ -150,7 +150,7 @@ TODO: 6 added.
TODO: 6 of 6 tasks shown TODO: 6 of 6 tasks shown
>>> todo.sh prepend 6 "make" >>> todo.sh prepend 6 "make"
6: make the coffee +wakeup 6 make the coffee +wakeup
>>> todo.sh -p list >>> todo.sh -p list
1 (B) smell the uppercase Roses +flowers @outside 1 (B) smell the uppercase Roses +flowers @outside

26
todo.sh
View File

@@ -332,12 +332,12 @@ replaceOrPrepend()
newtodo=$(sed "$item!d" "$TODO_FILE") newtodo=$(sed "$item!d" "$TODO_FILE")
case "$action" in case "$action" in
replace) replace)
echo "$item: $todo" echo "$item $todo"
echo "TODO: Replaced task with:" echo "TODO: Replaced task with:"
echo "$item: $newtodo" echo "$item $newtodo"
;; ;;
prepend) prepend)
echo "$item: $newtodo" echo "$item $newtodo"
;; ;;
esac esac
fi fi
@@ -547,7 +547,7 @@ _addto() {
TASKNUM=$(sed -n '$ =' "$file") TASKNUM=$(sed -n '$ =' "$file")
BASE=$(basename "$file") BASE=$(basename "$file")
PREFIX=$(echo ${BASE%%.[^.]*} | tr [a-z] [A-Z]) PREFIX=$(echo ${BASE%%.[^.]*} | tr [a-z] [A-Z])
echo "$TASKNUM: $input" echo "$TASKNUM $input"
echo "${PREFIX}: $TASKNUM added." echo "${PREFIX}: $TASKNUM added."
fi fi
} }
@@ -760,7 +760,7 @@ case $action in
if sed -i.bak $item" s|^.*|&${appendspace}${input}|" "$TODO_FILE"; then if sed -i.bak $item" s|^.*|&${appendspace}${input}|" "$TODO_FILE"; then
if [ $TODOTXT_VERBOSE -gt 0 ]; then if [ $TODOTXT_VERBOSE -gt 0 ]; then
newtodo=$(sed "$item!d" "$TODO_FILE") newtodo=$(sed "$item!d" "$TODO_FILE")
echo "$item: $newtodo" echo "$item $newtodo"
fi fi
else else
die "TODO: Error appending task $item." die "TODO: Error appending task $item."
@@ -795,7 +795,7 @@ case $action in
sed -i.bak -e $item"s/^.*//" "$TODO_FILE" sed -i.bak -e $item"s/^.*//" "$TODO_FILE"
fi fi
if [ $TODOTXT_VERBOSE -gt 0 ]; then if [ $TODOTXT_VERBOSE -gt 0 ]; then
echo "$item: $DELETEME" echo "$item $DELETEME"
echo "TODO: $item deleted." echo "TODO: $item deleted."
fi fi
else else
@@ -811,13 +811,13 @@ case $action in
"$TODO_FILE" "$TODO_FILE"
newtodo=$(sed "$item!d" "$TODO_FILE") newtodo=$(sed "$item!d" "$TODO_FILE")
if [ "$DELETEME" = "$newtodo" ]; then if [ "$DELETEME" = "$newtodo" ]; then
[ $TODOTXT_VERBOSE -gt 0 ] && echo "$item: $DELETEME" [ $TODOTXT_VERBOSE -gt 0 ] && echo "$item $DELETEME"
die "TODO: '$3' not found; no removal done." die "TODO: '$3' not found; no removal done."
fi fi
if [ $TODOTXT_VERBOSE -gt 0 ]; then if [ $TODOTXT_VERBOSE -gt 0 ]; then
echo "$item: $DELETEME" echo "$item $DELETEME"
echo "TODO: Removed '$3' from task." echo "TODO: Removed '$3' from task."
echo "$item: $newtodo" echo "$item $newtodo"
fi fi
fi fi
;; ;;
@@ -841,7 +841,7 @@ case $action in
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")
echo "$item: $NEWTODO" echo "$item $NEWTODO"
echo "TODO: $item deprioritized." echo "TODO: $item deprioritized."
fi fi
else else
@@ -873,7 +873,7 @@ case $action in
sed -i.bak $item"s|^|&x $now |" "$TODO_FILE" sed -i.bak $item"s|^|&x $now |" "$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")
echo "$item: $newtodo" echo "$item $newtodo"
echo "TODO: $item marked as done." echo "TODO: $item marked as done."
fi fi
else else
@@ -978,7 +978,7 @@ case $action in
echo "$MOVEME" >> "$dest" echo "$MOVEME" >> "$dest"
if [ $TODOTXT_VERBOSE -gt 0 ]; then if [ $TODOTXT_VERBOSE -gt 0 ]; then
echo "$item: $MOVEME" echo "$item $MOVEME"
echo "TODO: $item moved from '$src' to '$dest'." echo "TODO: $item moved from '$src' to '$dest'."
fi fi
else else
@@ -1009,7 +1009,7 @@ note: PRIORITY must be anywhere from A to Z."
sed -i.bak -e $item"s/^(.) //" -e $item"s/^/($newpri) /" "$TODO_FILE" sed -i.bak -e $item"s/^(.) //" -e $item"s/^/($newpri) /" "$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")
echo "$item: $NEWTODO" echo "$item $NEWTODO"
echo "TODO: $item prioritized ($newpri)." echo "TODO: $item prioritized ($newpri)."
fi fi
else else