#!/usr/bin/env bash DIRECTORY=events if [ ! -d "$DIRECTORY" ]; then mkdir $DIRECTORY fi echo $(curl -s "https://calendar.klank.school/api/events") | jq -c '.[]' | while read -r item; do slug=$(echo "$item" | jq -r '.slug') echo $item export TITLE=$(echo "$item" | jq -r '.title') export START_DATETIME=$(echo "$item" | jq -r '.start_datetime') export END_DATETIME=$(echo "$item" | jq -r '.end_datetime') filename="events/${slug}.md" if test -f "$filename"; then rm -f -- $filename fi mo templates/event.md >> $filename echo "Created a new event markdown file for " $filename done