mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-10 18:58:21 +02:00
Improve list-hourly-weather.ps1
This commit is contained in:
parent
63d5f5c796
commit
296ed2a05a
@ -14,10 +14,10 @@ try {
|
|||||||
$Area = $Weather.nearest_area.areaName.value
|
$Area = $Weather.nearest_area.areaName.value
|
||||||
$Region = $Weather.nearest_area.region.value
|
$Region = $Weather.nearest_area.region.value
|
||||||
$Country = $Weather.nearest_area.country.value
|
$Country = $Weather.nearest_area.country.value
|
||||||
"🕗 Hourly weather today at $Area ($Region, $Country)"
|
|
||||||
|
|
||||||
[int]$Hour = 0
|
[int]$Day = 0
|
||||||
foreach ($Hourly in $Weather.weather.hourly) {
|
foreach ($Hourly in $Weather.weather.hourly) {
|
||||||
|
$Hour = $Hourly.time / 100
|
||||||
$Temp = $Hourly.tempC
|
$Temp = $Hourly.tempC
|
||||||
$Precip = $Hourly.precipMM
|
$Precip = $Hourly.precipMM
|
||||||
$Humidity = $Hourly.humidity
|
$Humidity = $Hourly.humidity
|
||||||
@ -28,6 +28,16 @@ try {
|
|||||||
$Visib = $Hourly.visibility
|
$Visib = $Hourly.visibility
|
||||||
$Clouds = $Hourly.cloudcover
|
$Clouds = $Hourly.cloudcover
|
||||||
$Desc = $Hourly.weatherDesc.value
|
$Desc = $Hourly.weatherDesc.value
|
||||||
|
if ($Hour -eq 0) {
|
||||||
|
if ($Day -eq 0) {
|
||||||
|
"🕗 Today at $Area ($Region, $Country)"
|
||||||
|
} elseif ($Day -eq 1) {
|
||||||
|
"🕗 Tomorrow"
|
||||||
|
} else {
|
||||||
|
"🕗 Day After Tomorrow"
|
||||||
|
}
|
||||||
|
$Day++
|
||||||
|
}
|
||||||
"$($Hour)°°`t$($Temp)°C`t$($Precip)mm $($Humidity)%`t$($WindSpeed)km/h from $WindDir`t$($Pressure)hPa UV$($UV) $($Visib)km $($Clouds)% $Desc"
|
"$($Hour)°°`t$($Temp)°C`t$($Precip)mm $($Humidity)%`t$($WindSpeed)km/h from $WindDir`t$($Pressure)hPa UV$($UV) $($Visib)km $($Clouds)% $Desc"
|
||||||
$Hour++
|
$Hour++
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user