Skip to content

Instantly share code, notes, and snippets.

@benyanke
Created September 6, 2020 17:26
Show Gist options
  • Save benyanke/29e664d4da226d02fbebd85d89bd4cfa to your computer and use it in GitHub Desktop.
Save benyanke/29e664d4da226d02fbebd85d89bd4cfa to your computer and use it in GitHub Desktop.
Provides the feast day in your bashrc
function feast() {
tmp="`mktemp`"
export date="`date +"%Y-%m-%d"`"
timeout 1 curl https://www.missalemeum.com/en/api/v3/date/$date 2> /dev/null > $tmp
export title="`cat $tmp | jq -r .[].info.title`"
export tempora="`cat $tmp | jq -r .[].info.tempora`"
export rank="`cat $tmp | jq -r .[].info.rank`"
if [[ "$feast" != "null" && "$feast" != "" ]] ; then
echo "Feast: $tempora"
fi
if [[ "$title" != "null" && "$title" != "" ]] ; then
echo "$title"
fi
case $rank in
1)
rankMod="1st"
;;
2)
rankMod="2nd"
;;
3)
rankMod="3rd"
;;
4)
rankMod="4th"
;;
*)
rankMod="$rank"
;;
esac
echo "$rankMod class feast"
rm $tmp
}
echo ;
feast
echo ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment