Plaster
New
List
Login
text
default
isoraqathedh
2022.04.13 11:49:21
#!/bin/zsh get_and_format() { xargs jq "$1" | xargs -I{} units -t {}"$2" "$3" | xargs printf "$4\n" } select=${1-$BLOCK_INSTANCE} stat -c "%W %n" ~/Documents/Junk/weather-archives/owm_*.json | sort -rnk1 | head -n 1 | cut -d' ' -f2 | case $select in # Temperature temperature) get_and_format .current.temp K tempC "%4.2f°C";; apparent_temperature) get_and_format .current.feels_like K tempC "(%5.2f°C)";; # Wind wind_speed) get_and_format .current.wind_speed m/s km/hr "%5.1f km/h";; wind_gust) get_and_format .current.wind_gust m/s km/hr "(%5.1f km/h)";; wind_deg) get_and_format .current.wind_deg "" 1 "%03d°";; # Misc clouds) get_and_format .current.clouds "" 1 "%2d%%";; pressure) get_and_format .current.pressure "hPa" "hPa" "%6.1f hPa";; humidity) get_and_format .current.humidity "" 1 "%2d%%";; visibility) get_and_format .current.visibility m km "%5.2f km";; UV) get_and_format .current.uvi "" 1 "U%2.0f";; # Times sunrise) xargs jq .current.sunrise | xargs -I{} date -d "@{}" +"☀↑ %H:%M:%S";; sunset) xargs jq .current.sunset | xargs -I{} date -d "@{}" +"☀↓ %H:%M:%S";; now) xargs jq .current.dt | xargs -I{} date -d "@{}" +"🕛 %d%H%MJ";; esac
Raw
Annotate
Repaste