misc-scripts/fetch-covid.zsh

6 lines
290 B
Bash
Executable File

#!/bin/zsh
([ -v commands\[curl\] ] && [ -v commands\[jq\] ]) || return
typeset -g _cprompts_covid=($(curl -sL https://api.covid19api.com/country/${1:-germany} | jq -e '. |= sort_by (.Date) | .[-1,-2].Active'))
[ ! -z $_cprompts_covid[1] ] && <<< ${_cprompts_covid} > ${2:-~/.cache/covid}