mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
updates get-weather to remove the for loop (#313)
This commit is contained in:
parent
c3abd6439c
commit
73e67b8054
1 changed files with 3 additions and 3 deletions
|
@ -70,10 +70,10 @@ def get_weather_by_ip [locIdx: int, units: string, token: string] {
|
|||
let url_forecast = $"($URL_FORECAST)?lat=($coords.lat.0)&lon=($coords.lon.0)&units=($units)&appid=($token)"
|
||||
let weather = (fetch $url)
|
||||
let forecast_data = (fetch $url_forecast)
|
||||
let forecast = (for day in $forecast_data.list {
|
||||
let forecast = ($forecast_data.list | each {|day|
|
||||
{
|
||||
id: ($day.weather.0.id)
|
||||
dt: ($day.dt | into string | into datetime -z local | date format '%Y-%m-%d')
|
||||
dt: ($day.dt | into string | into datetime -z local | date format '%a, %b %e') #'%Y-%m-%d')
|
||||
high: ($day.temp.max)
|
||||
low: ($day.temp.min)
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ def get_weather_by_ip [locIdx: int, units: string, token: string] {
|
|||
let forecast = (for day in $forecast_data.list {
|
||||
{
|
||||
id: ($day.weather.0.id)
|
||||
dt: ($day.dt | into string | into datetime -z local | date format '%Y-%m-%d')
|
||||
dt: ($day.dt | into string | into datetime -z local | date format '%a, %b %e') #'%Y-%m-%d')
|
||||
high: ($day.temp.max)
|
||||
low: ($day.temp.min)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue