ENH: Sentence delimiters for append action.

This fixes a personal annoyance.
If the text to be appended to the task begins with one of the delimiter characters, no whitespace is inserted in between. This makes appending to an enumeration (todo.sh add 42 ", foo") syntactically correct.
The list of delimiters is configurable (for personal preferences / non-English languages) via SENTENCE_DELIMITERS in the config file.
This commit is contained in:
Ingo Karkat
2010-07-05 13:49:58 +02:00
parent 5e44868261
commit 2f4ba26994
2 changed files with 40 additions and 1 deletions

View File

@@ -44,4 +44,33 @@ test_todo_session 'append error' << EOF
10: No such task.
EOF
cat > todo.txt <<EOF
notice the daisies
EOF
test_todo_session 'append of current sentence' <<EOF
>>> todo.sh append 1 ", lilies and roses"
1: notice the daisies, lilies and roses
>>> todo.sh append 1 "; see the wasps"
1: notice the daisies, lilies and roses; see the wasps
>>> todo.sh append 1 "& bees"
1: notice the daisies, lilies and roses; see the wasps & bees
EOF
cp todo.cfg special-delimiters.cfg
cat >> special-delimiters.cfg <<EOF
export SENTENCE_DELIMITERS='*,.:;&'
EOF
test_todo_session 'append of current sentence SENTENCE_DELIMITERS' <<EOF
>>> todo.sh -d special-delimiters.cfg append 1 "&beans"
1: notice the daisies, lilies and roses; see the wasps & bees&beans
>>> todo.sh -d special-delimiters.cfg append 1 "%foo"
1: notice the daisies, lilies and roses; see the wasps & bees&beans %foo
>>> todo.sh -d special-delimiters.cfg append 1 "*2"
1: notice the daisies, lilies and roses; see the wasps & bees&beans %foo*2
EOF
test_done