From 2836d2f4452b538e24ca6b85ee27df7bce0b69b2 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 9 Feb 2022 19:23:08 +0100 Subject: Simplified scripts build process (removed SDEPDATA). --- scripts/sdep-list | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'scripts/sdep-list') diff --git a/scripts/sdep-list b/scripts/sdep-list index a9e5405..c1e89f9 100755 --- a/scripts/sdep-list +++ b/scripts/sdep-list @@ -4,7 +4,7 @@ # Recurring events are listed at most once, and only if their first occurrence # is in the range. # -# The events are read from the following files in the SDEPDATA folder: +# The events are read from the following files in the $sdepdata folder: # once: events that only happen once; full date needs to be specified # daily: events that happen every day; only specify the time in HH:MM format # weekly: only specify Weekday + time @@ -15,6 +15,8 @@ # Usage: sdep-list [today|tomorrow|week|nextweek|past|future] # No options = all +sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep" + from="" to="" w="%d %b %H:%M" @@ -52,13 +54,13 @@ esac tempfile=$(mktemp) -cat "SDEPDATA/once" > "$tempfile" -sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" | >> "$tempfile" +cat "$sdepdata/once" > "$tempfile" +sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" | >> "$tempfile" while read line; do weekday=$(echo "$line" | sed "s/ .*$//") echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" -done <"SDEPDATA/weekly" >> "$tempfile" -sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" >> "$tempfile" +done <"$sdepdata/weekly" >> "$tempfile" +sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" >> "$tempfile" sdep -w "$w" -f "$from" -t "$to" <"$tempfile" -- cgit v1.3