Skip to content

Commit

Permalink
Added sed line to allow priorities to be added on the command line wi…
Browse files Browse the repository at this point in the history
…th auto add date enabled.

Inserted test for this case in the t1010-add-date.sh test case.
  • Loading branch information
trws authored and ginatrapani committed Jul 8, 2011
1 parent e24777f commit 7900ad7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions tests/t1010-add-date.sh
Expand Up @@ -21,6 +21,22 @@ TODO: 1 added.
TODO: 1 of 1 tasks shown
EOF

test_todo_session 'cmd line first day with priority' <<EOF
>>> todo.sh -pt add '(A) notice the daisies'
2 (A) 2009-02-13 notice the daisies
TODO: 2 added.
>>> todo.sh -p list
2 (A) 2009-02-13 notice the daisies
1 2009-02-13 notice the daisies
--
TODO: 2 of 2 tasks shown
>>> todo.sh -npf del 2
2 (A) 2009-02-13 notice the daisies
TODO: 2 deleted.
EOF

test_tick

test_todo_session 'cmd line second day' <<EOF
Expand Down
2 changes: 1 addition & 1 deletion todo.sh
Expand Up @@ -619,7 +619,7 @@ _addto() {

if [[ $TODOTXT_DATE_ON_ADD = 1 ]]; then
now=$(date '+%Y-%m-%d')
input="$now $input"
input=`echo "$input" | sed -e 's/^\(([A-Z]) \)\{0,1\}/\1'"$now /"`
fi
echo "$input" >> "$file"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
Expand Down

0 comments on commit 7900ad7

Please sign in to comment.