Skip to content

Commit

Permalink
Add HIDE_CUSTOM_SUBSTITUTION for customization and add-ons.
Browse files Browse the repository at this point in the history
Add-ons or users may want to hide parts of the task text from the output.
Though this can already be solved through TODOTXT_FINAL_FILTER, augmenting the configured value is not trivial, and it introduces another SED command into the already long _list() pipeline. Putting an additional HIDE_CUSTOM_SUBSTITUTION into the existing pipeline has hardly any performance implications, and makes the realization of this use case trivial.
  • Loading branch information
inkarkat authored and ginatrapani committed Jan 20, 2012
1 parent 73e28b7 commit 8744167
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/t1300-ls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ test_todo_session 'checking TODOTXT_FINAL_FILTER' <<EOF
TODO: 3 of 3 tasks shown
EOF

#
# check the custom hiding
#
test_todo_session 'checking HIDE_CUSTOM_SUBSTITUTION' <<EOF
>>> HIDE_CUSTOM_SUBSTITUTION='[tT]h' todo.sh ls
2 aaa zzz is line should be first.
3 bbb yyy is line should be second.
1 ccc xxx is line should be ird.
--
TODO: 3 of 3 tasks shown
EOF

#
# check the filtering of TERM
#
Expand Down
1 change: 1 addition & 0 deletions todo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ _list() {
| sed '''
s/'"${HIDE_PROJECTS_SUBSTITUTION:-^}"'//g
s/'"${HIDE_CONTEXTS_SUBSTITUTION:-^}"'//g
s/'"${HIDE_CUSTOM_SUBSTITUTION:-^}"'//g
''' \
| eval ${TODOTXT_FINAL_FILTER} \
)
Expand Down

0 comments on commit 8744167

Please sign in to comment.