ENH: 'prepend' and 'replace' actions keep prepended date.
Generalized and simplified the logic that already kept an existing priority to also keep a date added via todo.sh -t / TODOTXT_DATE_ON_ADD (unless the replaced text also starts with a date).
This commit is contained in:
@@ -77,6 +77,7 @@ replaced with
|
||||
replaced with
|
||||
4: (A) collect the eggs
|
||||
EOF
|
||||
|
||||
test_todo_session 'replace with &' << EOF
|
||||
>>> todo.sh replace 3 "thrash the hay & thresh the wheat"
|
||||
3: jump on hay
|
||||
@@ -90,4 +91,44 @@ test_todo_session 'replace error' << EOF
|
||||
10: No such task.
|
||||
EOF
|
||||
|
||||
cat /dev/null > todo.txt
|
||||
test_todo_session 'replace handling prepended date on add' <<EOF
|
||||
>>> todo.sh -t add "new task"
|
||||
1: 2009-02-13 new task
|
||||
TODO: 1 added.
|
||||
|
||||
>>> todo.sh replace 1 this is just a new one
|
||||
1: 2009-02-13 new task
|
||||
replaced with
|
||||
1: 2009-02-13 this is just a new one
|
||||
|
||||
>>> todo.sh replace 1 2010-07-04 this also has a new date
|
||||
1: 2009-02-13 this is just a new one
|
||||
replaced with
|
||||
1: 2010-07-04 this also has a new date
|
||||
EOF
|
||||
|
||||
cat /dev/null > todo.txt
|
||||
test_todo_session 'replace handling priority and prepended date on add' <<EOF
|
||||
>>> todo.sh -t add "new task"
|
||||
1: 2009-02-13 new task
|
||||
TODO: 1 added.
|
||||
|
||||
>>> todo.sh pri 1 A
|
||||
1: (A) 2009-02-13 new task
|
||||
TODO: 1 prioritized (A).
|
||||
|
||||
>>> todo.sh replace 1 this is just a new one
|
||||
1: (A) 2009-02-13 new task
|
||||
replaced with
|
||||
1: (A) 2009-02-13 this is just a new one
|
||||
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
|
||||
1: (A) 2009-02-13 this is just a new one
|
||||
replaced with
|
||||
1: (A) 2010-07-04 this also has a new date
|
||||
EOF
|
||||
|
||||
test_done
|
||||
|
||||
@@ -57,4 +57,38 @@ test_todo_session 'prepend with &' <<EOF
|
||||
3: no running & jumping now stop
|
||||
EOF
|
||||
|
||||
cat /dev/null > todo.txt
|
||||
test_todo_session 'prepend handling prepended date on add' <<EOF
|
||||
>>> todo.sh -t add "new task"
|
||||
1: 2009-02-13 new task
|
||||
TODO: 1 added.
|
||||
|
||||
>>> todo.sh prepend 1 "this is just a"
|
||||
1: 2009-02-13 this is just a new task
|
||||
EOF
|
||||
|
||||
cat /dev/null > todo.txt
|
||||
test_todo_session 'prepend handling priority and prepended date on add' <<EOF
|
||||
>>> todo.sh -t add "new task"
|
||||
1: 2009-02-13 new task
|
||||
TODO: 1 added.
|
||||
|
||||
>>> todo.sh pri 1 A
|
||||
1: (A) 2009-02-13 new task
|
||||
TODO: 1 prioritized (A).
|
||||
|
||||
>>> todo.sh prepend 1 "this is just a"
|
||||
1: (A) 2009-02-13 this is just a new task
|
||||
EOF
|
||||
|
||||
cat /dev/null > todo.txt
|
||||
test_todo_session 'prepend with prepended date keeps both' <<EOF
|
||||
>>> todo.sh -t add "new task"
|
||||
1: 2009-02-13 new task
|
||||
TODO: 1 added.
|
||||
|
||||
>>> todo.sh prepend 1 "2010-07-04 this is just a"
|
||||
1: 2009-02-13 2010-07-04 this is just a new task
|
||||
EOF
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user