diff --git a/tests/t1320-listproj.sh b/tests/t1320-listproj.sh index 79b8bcf..454d245 100755 --- a/tests/t1320-listproj.sh +++ b/tests/t1320-listproj.sh @@ -55,4 +55,27 @@ test_todo_session 'listproj embedded + test' < todo.txt < done.txt <>> TODOTXT_SOURCEVAR=\$DONE_FILE todo.sh listproj ++done01 ++done02 +EOF +test_todo_session 'listproj from done tasks with filtering' <<'EOF' +>>> TODOTXT_SOURCEVAR=\$DONE_FILE todo.sh listproj Special ++done01 +EOF +test_todo_session 'listproj from combined open + done tasks' <<'EOF' +>>> TODOTXT_SOURCEVAR='("$TODO_FILE" "$DONE_FILE")' todo.sh listproj ++done01 ++done02 ++prj01 +EOF + test_done diff --git a/todo.sh b/todo.sh index d93c619..4c2a4d9 100755 --- a/todo.sh +++ b/todo.sh @@ -149,7 +149,7 @@ help() TODOTXT_DEFAULT_ACTION="" run this when called with no arguments TODOTXT_SORT_COMMAND="sort ..." customize list output TODOTXT_FINAL_FILTER="sed ..." customize list after color, P@+ hiding - TODOTXT_SOURCEVAR=\$DONE_FILE use another source for listcon + TODOTXT_SOURCEVAR=\$DONE_FILE use another source for listcon, listproj EndVerboseHelp @@ -1135,8 +1135,10 @@ case $action in ;; "listproj" | "lsprj" ) + FILE=$TODO_FILE + [ "$TODOTXT_SOURCEVAR" ] && eval "FILE=$TODOTXT_SOURCEVAR" shift - eval "$(filtercommand 'cat "$TODO_FILE"' '' "$@")" | grep -o '[^ ]*+[^ ]\+' | grep '^+' | sort -u + eval "$(filtercommand 'cat "${FILE[@]}"' '' "$@")" | grep -o '[^ ]*+[^ ]\+' | grep '^+' | sort -u ;; "listpri" | "lsp" )