diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/calendar-sample.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/calendar-sample.sh b/bin/calendar-sample.sh index 1937cf6..af583f6 100755 --- a/bin/calendar-sample.sh +++ b/bin/calendar-sample.sh @@ -13,6 +13,14 @@ CACHE="$CACHE_DIR/calendar.txt" umask 077 mkdir -p "$CACHE_DIR" +# Without khal the list below fails silently (its stderr is discarded), and the +# cache would claim an empty week. Removing the cache instead makes the card +# show its "no calendar data" face, which is the truth. +if ! command -v khal >/dev/null 2>&1; then + rm -f "$CACHE" + exit 1 +fi + TMP="$CACHE.tmp.$$" trap 'rm -f "$TMP"' EXIT |
