aboutsummaryrefslogtreecommitdiff
path: root/base/task/taskwarrior-holidays.sh
diff options
context:
space:
mode:
authorAlexis Hovorka <[email protected]>2020-11-10 23:21:19 -0700
committerAlexis Hovorka <[email protected]>2020-11-10 23:21:19 -0700
commit1c554f6862449baf859a1fee2fc3fcfa58813ed7 (patch)
treee7483ec445119649b24328f7421c8bb702cfdc50 /base/task/taskwarrior-holidays.sh
parent60dcbdd4fbcf91344dceab5b984afe32b3e21f8e (diff)
[feat] Add taskwarrior configuration
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