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, 5 insertions, 7 deletions
diff --git a/scripts/sdep-list b/scripts/sdep-list
index 50d3fe7..1a9a1bf 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,8 +15,6 @@
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/share}/sdep"
19
20from="" 18from=""
21to="" 19to=""
22w="%d %b %H:%M" 20w="%d %b %H:%M"
@@ -54,13 +52,13 @@ esac
54 52
55tempfile=$(mktemp) 53tempfile=$(mktemp)
56 54
57cat "$sdepdata/once" > "$tempfile" 55cat "SDEPDATA/once" > "$tempfile"
58sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" >> "$tempfile" 56sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" >> "$tempfile"
59while read line; do 57while read line; do
60 weekday=$(echo "$line" | sed "s/ .*$//") 58 weekday=$(echo "$line" | sed "s/ .*$//")
61 echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" 59 echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /"
62done <"$sdepdata/weekly" >> "$tempfile" 60done <"SDEPDATA/weekly" >> "$tempfile"
63sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" >> "$tempfile" 61sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" >> "$tempfile"
64 62
65sdep -w "$w" -f "$from" -t "$to" <"$tempfile" 63sdep -w "$w" -f "$from" -t "$to" <"$tempfile"
66 64

Generated with cgit - Back to sebastiano.tronto.net