aboutsummaryrefslogtreecommitdiff
path: root/scripts/sdep-list
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sdep-list')
-rwxr-xr-xscripts/sdep-list12
1 files changed, 7 insertions, 5 deletions
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 @@
4# Recurring events are listed at most once, and only if their first occurrence 4# Recurring events are listed at most once, and only if their first occurrence
5# is in the range. 5# is in the range.
6# 6#
7# The events are read from the following files in the SDEPDATA folder: 7# The events are read from the following files in the $sdepdata folder:
8# once: events that only happen once; full date needs to be specified 8# once: events that only happen once; full date needs to be specified
9# daily: events that happen every day; only specify the time in HH:MM format 9# daily: events that happen every day; only specify the time in HH:MM format
10# weekly: only specify Weekday + time 10# weekly: only specify Weekday + time
@@ -15,6 +15,8 @@
15# Usage: sdep-list [today|tomorrow|week|nextweek|past|future] 15# Usage: sdep-list [today|tomorrow|week|nextweek|past|future]
16# No options = all 16# No options = all
17 17
18sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep"
19
18from="" 20from=""
19to="" 21to=""
20w="%d %b %H:%M" 22w="%d %b %H:%M"
@@ -52,13 +54,13 @@ esac
52 54
53tempfile=$(mktemp) 55tempfile=$(mktemp)
54 56
55cat "SDEPDATA/once" > "$tempfile" 57cat "$sdepdata/once" > "$tempfile"
56sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" | >> "$tempfile" 58sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" | >> "$tempfile"
57while read line; do 59while read line; do
58 weekday=$(echo "$line" | sed "s/ .*$//") 60 weekday=$(echo "$line" | sed "s/ .*$//")
59 echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" 61 echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /"
60done <"SDEPDATA/weekly" >> "$tempfile" 62done <"$sdepdata/weekly" >> "$tempfile"
61sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" >> "$tempfile" 63sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" >> "$tempfile"
62 64
63sdep -w "$w" -f "$from" -t "$to" <"$tempfile" 65sdep -w "$w" -f "$from" -t "$to" <"$tempfile"
64 66

Generated with cgit - Back to sebastiano.tronto.net