aboutsummaryrefslogtreecommitdiff
path: root/base/task/taskwarrior-holidays.sh
blob: 97ddb4a4aa51b04c8784a8176cedd08d65ef056c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#/bin/bash

YEARNOW="$(date +%Y)"
YEARNEXT="$(date -d "next year" +%Y)"

(echo "[";
curl -s https://holidata.net/en-US/$YEARNOW.json  | sed "s/$/,/g";
curl -s https://holidata.net/en-US/$YEARNEXT.json | sed "s/$/,/g" | head -c-2;
echo "]") | jq -r 'map(select(.region == "")) | to_entries |
  map((.key+1 | tostring) + "\t" + .value.description + "\t" + .value.date) | .[]' |
while read e; do
  INDX="$(echo "$e" | cut -f1)"
  NAME="$(echo "$e" | cut -f2)"
  DATE="$(echo "$e" | cut -f3 | tr -d "-")"
  echo "holiday.en-US$INDX.name=$NAME"
  echo "holiday.en-US$INDX.date=$DATE"
done