ENH: TODOTXT_SOURCEVAR enables different source file for listcon.

To be used by todo_completion (to offer candidates from done.txt when there are no matches in todo.txt), and maybe by custom addons.
This commit is contained in:
Ingo Karkat
2012-02-21 12:11:45 +01:00
parent fbee428e75
commit 9e13dfd290
2 changed files with 24 additions and 2 deletions

View File

@@ -136,7 +136,7 @@ help()
EndOptionsHelp
[ $TODOTXT_VERBOSE -gt 1 ] && cat <<-EndVerboseHelp
[ $TODOTXT_VERBOSE -gt 1 ] && cat <<-'EndVerboseHelp'
Environment variables:
TODOTXT_AUTO_ARCHIVE is same as option -a (0)/-A (1)
TODOTXT_CFG_FILE=CONFIG_FILE is same as option -d CONFIG_FILE
@@ -149,6 +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
EndVerboseHelp
@@ -1128,7 +1129,9 @@ case $action in
;;
"listcon" | "lsc" )
grep -o '[^ ]*@[^ ]\+' "$TODO_FILE" | grep '^@' | sort -u
FILE=$TODO_FILE
[ "$TODOTXT_SOURCEVAR" ] && eval "FILE=$TODOTXT_SOURCEVAR"
grep -ho '[^ ]*@[^ ]\+' "${FILE[@]}" | grep '^@' | sort -u
;;
"listproj" | "lsprj" )