From b131b3e2d083883208a87761e2b9603e23dfd181 Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Sat, 7 Jan 2012 23:06:54 +0100 Subject: [PATCH] Add HIDE_CUSTOM_SUBSTITUTION for customization and add-ons. 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. --- tests/t1300-ls.sh | 12 ++++++++++++ todo.sh | 1 + 2 files changed, 13 insertions(+) diff --git a/tests/t1300-ls.sh b/tests/t1300-ls.sh index 9493533..1a69249 100755 --- a/tests/t1300-ls.sh +++ b/tests/t1300-ls.sh @@ -53,6 +53,18 @@ test_todo_session 'checking TODOTXT_FINAL_FILTER' <>> 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 # diff --git a/todo.sh b/todo.sh index 94c088c..b50e3c9 100755 --- a/todo.sh +++ b/todo.sh @@ -814,6 +814,7 @@ _list() { | sed ''' s/'"${HIDE_PROJECTS_SUBSTITUTION:-^}"'//g s/'"${HIDE_CONTEXTS_SUBSTITUTION:-^}"'//g + s/'"${HIDE_CUSTOM_SUBSTITUTION:-^}"'//g ''' \ | eval ${TODOTXT_FINAL_FILTER} \ )