diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2022-02-09 19:23:08 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2022-02-09 19:23:08 +0100 |
| commit | 2836d2f4452b538e24ca6b85ee27df7bce0b69b2 (patch) | |
| tree | 8c45994a9ee4b80589f718c7eb0e647c6c53881f /scripts/sdep-list | |
| parent | 0bcca7b6808a02af3c4758c30eec9984d44dfac7 (diff) | |
| download | sdep-2836d2f4452b538e24ca6b85ee27df7bce0b69b2.tar.gz sdep-2836d2f4452b538e24ca6b85ee27df7bce0b69b2.zip | |
Simplified scripts build process (removed SDEPDATA).
Diffstat (limited to '')
| -rwxr-xr-x | scripts/sdep-list | 12 |
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 | ||
| 18 | sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep" | ||
| 19 | |||
| 18 | from="" | 20 | from="" |
| 19 | to="" | 21 | to="" |
| 20 | w="%d %b %H:%M" | 22 | w="%d %b %H:%M" |
| @@ -52,13 +54,13 @@ esac | |||
| 52 | 54 | ||
| 53 | tempfile=$(mktemp) | 55 | tempfile=$(mktemp) |
| 54 | 56 | ||
| 55 | cat "SDEPDATA/once" > "$tempfile" | 57 | cat "$sdepdata/once" > "$tempfile" |
| 56 | sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" | >> "$tempfile" | 58 | sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" | >> "$tempfile" |
| 57 | while read line; do | 59 | while 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) /" |
| 60 | done <"SDEPDATA/weekly" >> "$tempfile" | 62 | done <"$sdepdata/weekly" >> "$tempfile" |
| 61 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" >> "$tempfile" | 63 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" >> "$tempfile" |
| 62 | 64 | ||
| 63 | sdep -w "$w" -f "$from" -t "$to" <"$tempfile" | 65 | sdep -w "$w" -f "$from" -t "$to" <"$tempfile" |
| 64 | 66 | ||
