ENH: TODOTXT_SOURCEVAR enables different source file for listproj.

This commit is contained in:
Ingo Karkat
2012-02-21 12:30:01 +01:00
parent 9e13dfd290
commit 46afb7f46a
2 changed files with 27 additions and 2 deletions

View File

@@ -55,4 +55,27 @@ test_todo_session 'listproj embedded + test' <<EOF
+prj02
EOF
cat > todo.txt <<EOF
+prj01 -- Some project 1 task
EOF
cat > done.txt <<EOF
x 2012-02-21 +done01 -- Special project 1 done task
x 2012-02-21 +done02 -- Some project 2 done task
EOF
test_todo_session 'listproj from done tasks' <<'EOF'
>>> 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

View File

@@ -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" )