aboutsummaryrefslogtreecommitdiff
path: root/base/task/taskwarrior-holidays.sh
diff options
context:
space:
mode:
Diffstat (limited to 'base/task/taskwarrior-holidays.sh')
-rwxr-xr-xbase/task/taskwarrior-holidays.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/base/task/taskwarrior-holidays.sh b/base/task/taskwarrior-holidays.sh
new file mode 100755
index 0000000..97ddb4a
--- /dev/null
+++ b/base/task/taskwarrior-holidays.sh
@@ -0,0 +1,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