2020-04-14 18:09:10 +00:00
|
|
|
typeset -gi _mail_count
|
2020-04-06 21:30:24 +00:00
|
|
|
function prompt_docker_host() {
|
2020-04-14 18:09:10 +00:00
|
|
|
p10k segment -b blue -i '' -t "${DOCKER_HOST#*://}" -c "${DOCKER_HOST#*://}"
|
2020-04-06 21:30:24 +00:00
|
|
|
}
|
|
|
|
typeset -g POWERLEVEL9K_DOCKER_HOST_SHOW_ON_COMMAND='docker'
|
|
|
|
function prompt_new_mail() {
|
2020-04-16 01:02:54 +00:00
|
|
|
_mail_count=(~/Mail/*/Inbox/new/*(.N))
|
|
|
|
(( ${#_mail_count} > 0 )) || return
|
|
|
|
p10k segment -b yellow -i '' -t "${#_mail_count}"
|
2020-04-06 21:30:24 +00:00
|
|
|
}
|
2020-04-14 18:09:10 +00:00
|
|
|
function prompt_covid_19() {
|
2020-04-16 01:02:54 +00:00
|
|
|
local tmpfile=~/.cache/covidres
|
2020-04-14 18:09:10 +00:00
|
|
|
local -a stats
|
|
|
|
zstat -A stats +mtime -- $tmpfile 2>/dev/null
|
|
|
|
if [[ $stats[1] < $(($epochtime[1]-86400)) ]]; then
|
2020-05-03 11:56:52 +00:00
|
|
|
local result=$(curl -sL https://api.covid19api.com/country/germany/status/confirmed/live | jq -e '. |= sort_by (.Date) | .[-1].Cases')
|
2020-04-14 18:09:10 +00:00
|
|
|
[ ! -z $result ] && print $result > $tmpfile
|
|
|
|
fi
|
|
|
|
p10k segment -b red -i '' -t "$(< $tmpfile)"
|
|
|
|
}
|