Made verbose message of _addto() consistent with other task messages.
In verbose mode, commands first print the updated task, then summarize the change in the following line. The add/addm/addto commands deviated from this, using "TODO: '<task>' added on line N." This change splits this into two separate lines, obsoletes the implementation jargon of "line", and makes it easier to visually parse the message. This is also a preparation for a possible future use of a _list()-like function, so that the updated task is processed and highlighted like the normal task output.
This commit is contained in:
committed by
Gina Trapani
parent
821b9d2795
commit
9f03cf6847
@@ -12,7 +12,8 @@ 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
|
||||||
TODO: 'notice the daisies' added on line 1.
|
1: notice the daisies
|
||||||
|
TODO: 1 added.
|
||||||
|
|
||||||
>>> todo.sh list
|
>>> todo.sh list
|
||||||
1 notice the daisies
|
1 notice the daisies
|
||||||
@@ -20,7 +21,8 @@ TODO: 'notice the daisies' added on line 1.
|
|||||||
TODO: 1 of 1 tasks shown
|
TODO: 1 of 1 tasks shown
|
||||||
|
|
||||||
>>> todo.sh add smell the roses
|
>>> todo.sh add smell the roses
|
||||||
TODO: 'smell the roses' added on line 2.
|
2: smell the roses
|
||||||
|
TODO: 2 added.
|
||||||
|
|
||||||
>>> todo.sh list
|
>>> todo.sh list
|
||||||
1 notice the daisies
|
1 notice the daisies
|
||||||
@@ -46,7 +48,8 @@ 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
|
||||||
TODO: 'smell the uppercase Roses' added on line 3.
|
3: smell the uppercase Roses
|
||||||
|
TODO: 3 added.
|
||||||
|
|
||||||
>>> todo.sh list roses
|
>>> todo.sh list roses
|
||||||
2 smell the roses
|
2 smell the roses
|
||||||
@@ -57,7 +60,8 @@ 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"
|
||||||
TODO: 'dig the garden & water the flowers' added on line 4.
|
4: dig the garden & water the flowers
|
||||||
|
TODO: 4 added.
|
||||||
|
|
||||||
>>> todo.sh list
|
>>> todo.sh list
|
||||||
4 dig the garden & water the flowers
|
4 dig the garden & water the flowers
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ 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
|
||||||
TODO: '2009-02-13 notice the daisies' added on line 1.
|
1: 2009-02-13 notice the daisies
|
||||||
|
TODO: 1 added.
|
||||||
|
|
||||||
>>> todo.sh list
|
>>> todo.sh list
|
||||||
1 2009-02-13 notice the daisies
|
1 2009-02-13 notice the daisies
|
||||||
@@ -24,7 +25,8 @@ 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
|
||||||
TODO: '2009-02-14 smell the roses' added on line 2.
|
2: 2009-02-14 smell the roses
|
||||||
|
TODO: 2 added.
|
||||||
|
|
||||||
>>> todo.sh list
|
>>> todo.sh list
|
||||||
1 2009-02-13 notice the daisies
|
1 2009-02-13 notice the daisies
|
||||||
@@ -37,7 +39,8 @@ 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
|
||||||
TODO: '2009-02-15 mow the lawn' added on line 3.
|
3: 2009-02-15 mow the lawn
|
||||||
|
TODO: 3 added.
|
||||||
|
|
||||||
>>> todo.sh list
|
>>> todo.sh list
|
||||||
1 2009-02-13 notice the daisies
|
1 2009-02-13 notice the daisies
|
||||||
@@ -55,7 +58,8 @@ 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
|
||||||
TODO: '2009-02-15 take out the trash' added on line 4.
|
4: 2009-02-15 take out the trash
|
||||||
|
TODO: 4 added.
|
||||||
|
|
||||||
>>> todo.sh list
|
>>> todo.sh list
|
||||||
1 2009-02-13 notice the daisies
|
1 2009-02-13 notice the daisies
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ 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
|
||||||
GARDEN: 'notice the daisies' added on line 1.
|
1: notice the daisies
|
||||||
|
GARDEN: 1 added.
|
||||||
|
|
||||||
>>> todo.sh listfile garden.txt
|
>>> todo.sh listfile garden.txt
|
||||||
1 notice the daisies
|
1 notice the daisies
|
||||||
@@ -27,7 +28,8 @@ GARDEN: 'notice the daisies' added on line 1.
|
|||||||
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
|
||||||
GARDEN: 'smell the roses' added on line 2.
|
2: smell the roses
|
||||||
|
GARDEN: 2 added.
|
||||||
|
|
||||||
>>> todo.sh listfile garden.txt
|
>>> todo.sh listfile garden.txt
|
||||||
1 notice the daisies
|
1 notice the daisies
|
||||||
@@ -53,7 +55,8 @@ 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
|
||||||
GARDEN: 'smell the uppercase Roses' added on line 3.
|
3: smell the uppercase Roses
|
||||||
|
GARDEN: 3 added.
|
||||||
|
|
||||||
>>> todo.sh listfile garden.txt roses
|
>>> todo.sh listfile garden.txt roses
|
||||||
2 smell the roses
|
2 smell the roses
|
||||||
@@ -64,7 +67,8 @@ 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"
|
||||||
GARDEN: 'dig the garden & water the flowers' added on line 4.
|
4: dig the garden & water the flowers
|
||||||
|
GARDEN: 4 added.
|
||||||
|
|
||||||
>>> todo.sh listfile garden.txt
|
>>> todo.sh listfile garden.txt
|
||||||
4 dig the garden & water the flowers
|
4 dig the garden & water the flowers
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ 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
|
||||||
GARDEN: '2009-02-13 notice the daisies' added on line 1.
|
1: 2009-02-13 notice the daisies
|
||||||
|
GARDEN: 1 added.
|
||||||
|
|
||||||
>>> todo.sh listfile garden.txt
|
>>> todo.sh listfile garden.txt
|
||||||
1 2009-02-13 notice the daisies
|
1 2009-02-13 notice the daisies
|
||||||
@@ -26,7 +27,8 @@ 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
|
||||||
GARDEN: '2009-02-14 smell the roses' added on line 2.
|
2: 2009-02-14 smell the roses
|
||||||
|
GARDEN: 2 added.
|
||||||
|
|
||||||
>>> todo.sh listfile garden.txt
|
>>> todo.sh listfile garden.txt
|
||||||
1 2009-02-13 notice the daisies
|
1 2009-02-13 notice the daisies
|
||||||
@@ -39,7 +41,8 @@ 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
|
||||||
GARDEN: '2009-02-15 mow the lawn' added on line 3.
|
3: 2009-02-15 mow the lawn
|
||||||
|
GARDEN: 3 added.
|
||||||
|
|
||||||
>>> todo.sh listfile garden.txt
|
>>> todo.sh listfile garden.txt
|
||||||
1 2009-02-13 notice the daisies
|
1 2009-02-13 notice the daisies
|
||||||
@@ -57,7 +60,8 @@ 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
|
||||||
GARDEN: '2009-02-15 take out the trash' added on line 4.
|
4: 2009-02-15 take out the trash
|
||||||
|
GARDEN: 4 added.
|
||||||
|
|
||||||
>>> todo.sh listfile garden.txt
|
>>> todo.sh listfile garden.txt
|
||||||
1 2009-02-13 notice the daisies
|
1 2009-02-13 notice the daisies
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ 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"
|
||||||
TODO: 'smell the coffee +wakeup' added on line 4.
|
4: smell the coffee +wakeup
|
||||||
|
TODO: 4 added.
|
||||||
|
|
||||||
>>> todo.sh -p list
|
>>> todo.sh -p list
|
||||||
2 (A) notice the sunflowers
|
2 (A) notice the sunflowers
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ fi
|
|||||||
|
|
||||||
## Add test
|
## Add test
|
||||||
# Create the expected file
|
# Create the expected file
|
||||||
echo "TODO: 'eat apples eat oranges drink milk' added on line 2.">$HOME/expect.multi
|
echo "2: eat apples eat oranges drink milk
|
||||||
|
TODO: 2 added.">$HOME/expect.multi
|
||||||
|
|
||||||
test_expect_success 'multiline squash item add' '
|
test_expect_success 'multiline squash item add' '
|
||||||
(
|
(
|
||||||
@@ -108,9 +109,12 @@ fi
|
|||||||
|
|
||||||
## Multiple line addition
|
## Multiple line addition
|
||||||
# Create the expected file
|
# Create the expected file
|
||||||
echo "TODO: 'eat apples' added on line 2." > $HOME/expect.multi
|
echo "2: eat apples
|
||||||
echo "TODO: 'eat oranges' added on line 3." >>$HOME/expect.multi
|
TODO: 2 added." > $HOME/expect.multi
|
||||||
echo "TODO: 'drink milk' added on line 4." >> $HOME/expect.multi
|
echo "3: eat oranges
|
||||||
|
TODO: 3 added." >>$HOME/expect.multi
|
||||||
|
echo "4: drink milk
|
||||||
|
TODO: 4 added." >> $HOME/expect.multi
|
||||||
|
|
||||||
test_expect_success 'actual multiline add' '
|
test_expect_success 'actual multiline add' '
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ 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"
|
||||||
TODO: 'make the coffee +wakeup' added on line 5.
|
5: make the coffee +wakeup
|
||||||
|
TODO: 5 added.
|
||||||
|
|
||||||
>>> todo.sh -p list coffee
|
>>> todo.sh -p list coffee
|
||||||
5 make the coffee +wakeup
|
5 make the coffee +wakeup
|
||||||
@@ -57,7 +58,8 @@ TODO: 'make the coffee +wakeup' added on line 5.
|
|||||||
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"
|
||||||
TODO: 'visit http://example.com' added on line 6.
|
6: visit http://example.com
|
||||||
|
TODO: 6 added.
|
||||||
|
|
||||||
>>> todo.sh -p list
|
>>> todo.sh -p list
|
||||||
1 (B) smell the uppercase Roses +flowers @outside
|
1 (B) smell the uppercase Roses +flowers @outside
|
||||||
@@ -134,7 +136,8 @@ 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"
|
||||||
TODO: 'the coffee +wakeup' added on line 6.
|
6: the coffee +wakeup
|
||||||
|
TODO: 6 added.
|
||||||
|
|
||||||
>>> todo.sh -p list
|
>>> todo.sh -p list
|
||||||
1 (B) smell the uppercase Roses +flowers @outside
|
1 (B) smell the uppercase Roses +flowers @outside
|
||||||
|
|||||||
3
todo.sh
3
todo.sh
@@ -484,7 +484,8 @@ _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 "${PREFIX}: '$input' added on line $TASKNUM."
|
echo "$TASKNUM: $input"
|
||||||
|
echo "${PREFIX}: $TASKNUM added."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user