Updated add command to accept lowercase priority (#230)
- Updated add command to accept lowercase priority - Added testcase for add with lowercase priority
This commit is contained in:
committed by
Ali Karbassi
parent
eeb5703728
commit
94e1c6e406
@@ -37,6 +37,22 @@ TODO: 2 of 2 tasks shown
|
|||||||
TODO: 2 deleted.
|
TODO: 2 deleted.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
test_todo_session 'cmd line first day with lowercase priority' <<EOF
|
||||||
|
>>> todo.sh -pt add '(b) notice the daisies'
|
||||||
|
2 (B) 2009-02-13 notice the daisies
|
||||||
|
TODO: 2 added.
|
||||||
|
|
||||||
|
>>> todo.sh -p list
|
||||||
|
2 (B) 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 (B) 2009-02-13 notice the daisies
|
||||||
|
TODO: 2 deleted.
|
||||||
|
EOF
|
||||||
|
|
||||||
test_tick
|
test_tick
|
||||||
|
|
||||||
test_todo_session 'cmd line second day' <<EOF
|
test_todo_session 'cmd line second day' <<EOF
|
||||||
|
|||||||
14
todo.sh
14
todo.sh
@@ -465,6 +465,19 @@ replaceOrPrepend()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uppercasePriority()
|
||||||
|
{
|
||||||
|
# Precondition: $input contains task text for which to uppercase priority.
|
||||||
|
# Postcondition: Modifies $input.
|
||||||
|
lower=( {a..z} )
|
||||||
|
upper=( {A..Z} )
|
||||||
|
for ((i=0; i<26; i++))
|
||||||
|
do
|
||||||
|
upperPriority="${upperPriority};s/^[(]${lower[i]}[)]/(${upper[i]})/"
|
||||||
|
done
|
||||||
|
input=$(echo "$input" | sed $upperPriority)
|
||||||
|
}
|
||||||
|
|
||||||
#Preserving environment variables so they don't get clobbered by the config file
|
#Preserving environment variables so they don't get clobbered by the config file
|
||||||
OVR_TODOTXT_AUTO_ARCHIVE="$TODOTXT_AUTO_ARCHIVE"
|
OVR_TODOTXT_AUTO_ARCHIVE="$TODOTXT_AUTO_ARCHIVE"
|
||||||
OVR_TODOTXT_FORCE="$TODOTXT_FORCE"
|
OVR_TODOTXT_FORCE="$TODOTXT_FORCE"
|
||||||
@@ -773,6 +786,7 @@ _addto() {
|
|||||||
file="$1"
|
file="$1"
|
||||||
input="$2"
|
input="$2"
|
||||||
cleaninput
|
cleaninput
|
||||||
|
uppercasePriority
|
||||||
|
|
||||||
if [[ $TODOTXT_DATE_ON_ADD = 1 ]]; then
|
if [[ $TODOTXT_DATE_ON_ADD = 1 ]]; then
|
||||||
now=$(date '+%Y-%m-%d')
|
now=$(date '+%Y-%m-%d')
|
||||||
|
|||||||
Reference in New Issue
Block a user