ENH: Allow configuring null data files and then don't create them.

Request from exatto (http://article.gmane.org/gmane.comp.diary.todotxt/4699), who doesn't want to use done.txt and report.txt.

Also consider character devices (-c; /dev/null is one) in the file existence checks so that no empty file is then created.
This commit is contained in:
Ingo Karkat
2013-11-05 13:02:40 +01:00
parent 111afe6958
commit 2faf072cf7
2 changed files with 52 additions and 3 deletions

View File

@@ -709,9 +709,9 @@ ACTION=${1:-$TODOTXT_DEFAULT_ACTION}
[ -d "$TODO_DIR" ] || dieWithHelp "$1" "Fatal Error: $TODO_DIR is not a directory"
( cd "$TODO_DIR" ) || dieWithHelp "$1" "Fatal Error: Unable to cd to $TODO_DIR"
[ -f "$TODO_FILE" ] || cp /dev/null "$TODO_FILE"
[ -f "$DONE_FILE" ] || cp /dev/null "$DONE_FILE"
[ -f "$REPORT_FILE" ] || cp /dev/null "$REPORT_FILE"
[ -f "$TODO_FILE" -o -c "$TODO_FILE" ] || cp /dev/null "$TODO_FILE"
[ -f "$DONE_FILE" -o -c "$DONE_FILE" ] || cp /dev/null "$DONE_FILE"
[ -f "$REPORT_FILE" -o -c "$REPORT_FILE" ] || cp /dev/null "$REPORT_FILE"
if [ $TODOTXT_PLAIN = 1 ]; then
for clr in ${!PRI_@}; do