mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-22 19:26:49 +01:00
Update list-weather.ps1
This commit is contained in:
parent
3dc176d9e8
commit
4ab6f26645
@ -16,8 +16,7 @@
|
|||||||
param([string]$Location = "") # empty means determine automatically
|
param([string]$Location = "") # empty means determine automatically
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Weather = (invoke-webRequest -uri http://wttr.in/${Location}?format=j1 -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
|
$Weather = (Invoke-WebRequest -URI http://wttr.in/${Location}?format=j1 -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
|
||||||
|
|
||||||
$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
|
||||||
@ -36,11 +35,11 @@ try {
|
|||||||
$Desc = $Hourly.weatherDesc.value
|
$Desc = $Hourly.weatherDesc.value
|
||||||
if ($Hour -eq 0) {
|
if ($Hour -eq 0) {
|
||||||
if ($Day -eq 0) {
|
if ($Day -eq 0) {
|
||||||
write-host -foregroundColor green "🕗 🌡°C ☂️ 💧 💨 from ☀️UV ☁️ TODAY at $Area ($Region, $Country)"
|
write-host -foregroundColor green "TODAY 🌡°C ☂️ 💧 💨 from ☀️UV ☁️ at $Area ($Region, $Country)"
|
||||||
} elseif ($Day -eq 1) {
|
} elseif ($Day -eq 1) {
|
||||||
write-host -foregroundColor green " TOMORROW"
|
write-host -foregroundColor green "TOMORROW"
|
||||||
} else {
|
} else {
|
||||||
write-host -foregroundColor green " DAY AFTER TOMORROW"
|
write-host -foregroundColor green "DAY AFTER TOMORROW"
|
||||||
}
|
}
|
||||||
$Day++
|
$Day++
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user