mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-24 15:49:02 +01: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
|
||||
$Region = $Weather.nearest_area.region.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) {
|
||||
$Hour = $Hourly.time / 100
|
||||
$Temp = $Hourly.tempC
|
||||
$Precip = $Hourly.precipMM
|
||||
$Humidity = $Hourly.humidity
|
||||
@ -28,6 +28,16 @@ try {
|
||||
$Visib = $Hourly.visibility
|
||||
$Clouds = $Hourly.cloudcover
|
||||
$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++
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user