File tree Expand file tree Collapse file tree 5 files changed +20
-10
lines changed
Expand file tree Collapse file tree 5 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -32,4 +32,9 @@ test_todo_session 'list after archive' <<EOF
3232TODO: 5 of 5 tasks shown
3333EOF
3434
35+ test_todo_session ' archive warning message' << EOF
36+ >>> todo.sh archive
37+ TODO: $HOME /todo.txt does not contain any done tasks.
38+ EOF
39+
3540test_done
Original file line number Diff line number Diff line change 1616
1717test_todo_session ' create new report' << EOF
1818>>> todo.sh report
19- TODO: $HOME /todo.txt archived .
19+ TODO: $HOME /todo.txt does not contain any done tasks .
20202009-02-13T04:40:00 5 0
2121TODO: Report file updated.
2222
@@ -38,7 +38,7 @@ x 2009-02-13 smell the coffee +wakeup
3838TODO: $HOME /todo.txt archived.
3939
4040>>> todo.sh report
41- TODO: $HOME /todo.txt archived .
41+ TODO: $HOME /todo.txt does not contain any done tasks .
42422009-02-13T04:40:00 4 1
4343TODO: Report file updated.
4444
@@ -83,7 +83,7 @@ test_todo_session 'report is unchanged when no changes' <<EOF
83832009-02-13T04:40:00 3 2
8484
8585>>> todo.sh report
86- TODO: $HOME /todo.txt archived .
86+ TODO: $HOME /todo.txt does not contain any done tasks .
87872009-02-13T04:40:00 3 2
8888TODO: Report file is up-to-date.
8989
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ test_expect_success 'no done file has been created by the archiving' '[ ! -e don
3838
3939test_todo_session ' perform report' << EOF
4040>>> todo.sh -d test.cfg report
41- TODO: ./todo.txt archived .
41+ TODO: ./todo.txt does not contain any done tasks .
42422009-02-13T04:40:00 0 0
4343TODO: Report file updated.
4444EOF
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ TODO: $HOME/todo.txt archived.
8585TODO: 5 of 5 tasks shown
8686
8787>>> todo.sh report
88- TODO: $HOME /todo.txt archived .
88+ TODO: $HOME /todo.txt does not contain any done tasks .
89892009-02-13T04:40:00 5 1
9090TODO: Report file updated.
9191
Original file line number Diff line number Diff line change @@ -1172,11 +1172,16 @@ case $action in
11721172" archive" )
11731173 # defragment blank lines
11741174 sed -i.bak -e ' /./!d' " $TODO_FILE "
1175- [ " $TODOTXT_VERBOSE " -gt 0 ] && grep " ^x " " $TODO_FILE "
1176- grep " ^x " " $TODO_FILE " >> " $DONE_FILE "
1177- sed -i.bak ' /^x /d' " $TODO_FILE "
1178- if [ " $TODOTXT_VERBOSE " -gt 0 ]; then
1179- echo " TODO: $TODO_FILE archived."
1175+ if grep " ^x " " $TODO_FILE " >> " $DONE_FILE " ; then
1176+ [ " $TODOTXT_VERBOSE " -gt 0 ] && grep " ^x " " $TODO_FILE "
1177+ sed -i.bak ' /^x /d' " $TODO_FILE "
1178+ if [ " $TODOTXT_VERBOSE " -gt 0 ]; then
1179+ echo " TODO: $TODO_FILE archived."
1180+ fi
1181+ else
1182+ if [ " $TODOTXT_VERBOSE " -gt 0 ]; then
1183+ echo " TODO: $TODO_FILE does not contain any done tasks."
1184+ fi
11801185 fi
11811186 ;;
11821187
You can’t perform that action at this time.
0 commit comments