2020-06-20 11:11:09 +00:00
|
|
|
([ -v commands\[curl\] ] && [ -v commands\[jq\] ]) || return
|
2020-07-18 22:43:39 +00:00
|
|
|
local tmpfile=$CACHEPATH/weather
|
2020-06-20 11:11:09 +00:00
|
|
|
|
2020-10-24 11:41:04 +00:00
|
|
|
local -a stats
|
|
|
|
zstat -A stats +mtime -- $tmpfile 2>/dev/null
|
|
|
|
if [ ${stats[1]:-0} -lt $(($epochtime[1]-3600)) ]; then
|
|
|
|
cprompts:cache:async:weather &!
|
|
|
|
else
|
|
|
|
typeset -g _cprompts_weather=($(< $tmpfile))
|
2020-06-20 11:11:09 +00:00
|
|
|
fi
|
2020-09-26 17:17:43 +00:00
|
|
|
[ -v _cprompts_weather ] && p10k segment -b ${_cprompts_weather[2]:-white} -i ${_cprompts_weather[3]:-\?} -t "${_cprompts_weather[1]:-unknown}"
|