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:
Daniel St.Jacques
2017-10-10 10:10:34 -04:00
committed by Ali Karbassi
parent eeb5703728
commit 94e1c6e406
2 changed files with 30 additions and 0 deletions

14
todo.sh
View File

@@ -465,6 +465,19 @@ replaceOrPrepend()
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
OVR_TODOTXT_AUTO_ARCHIVE="$TODOTXT_AUTO_ARCHIVE"
OVR_TODOTXT_FORCE="$TODOTXT_FORCE"
@@ -773,6 +786,7 @@ _addto() {
file="$1"
input="$2"
cleaninput
uppercasePriority
if [[ $TODOTXT_DATE_ON_ADD = 1 ]]; then
now=$(date '+%Y-%m-%d')