klank-docs/get_events.sh

32 lines
703 B
Bash
Raw Normal View History

2024-11-12 13:11:02 +00:00
#!/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
2024-11-25 15:01:56 +00:00
# mo templates/event.md >> $filename
# echo "Created a new event markdown file for " $filename
echo "Whoops! This template is not accessible anymore. Please update me :) "
2024-11-12 13:11:02 +00:00
done