1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 15:17:47 +00:00

update nth to select (#147)

This commit is contained in:
Michael Angerman 2022-02-15 17:01:42 -08:00 committed by GitHub
parent 166a9b5eac
commit c326716e99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View file

@ -12,12 +12,12 @@ def locations [] {
} }
def get_my_location [index: int] { def get_my_location [index: int] {
let loc_json = (fetch (locations | nth $index).0.location) let loc_json = (fetch (locations | select $index).0.location)
let city_column = (locations | nth $index).0.city_column let city_column = (locations | select $index).0.city_column
let state_column = (locations | nth $index).0.state_column let state_column = (locations | select $index).0.state_column
let country_column = (locations | nth $index).0.country_column let country_column = (locations | select $index).0.country_column
let lat_column = (locations | nth $index).0.lat_column let lat_column = (locations | select $index).0.lat_column
let lon_column = (locations | nth $index).0.lon_column let lon_column = (locations | select $index).0.lon_column
# echo $loc_json # echo $loc_json
if ($city_column | str length) > 1 { if ($city_column | str length) > 1 {

View file

@ -70,6 +70,7 @@ def timed_weather_run [
$weather_table | update last_run_time {(date now | date format '%Y-%m-%d %H:%M:%S %z')} | save $weather_runtime_file $weather_table | update last_run_time {(date now | date format '%Y-%m-%d %H:%M:%S %z')} | save $weather_runtime_file
} }
} else { } else {
echo "Your command did not run because you are not on Windows..."
# ToDo: refactor the info in the Windows section into another def. The only real difference # ToDo: refactor the info in the Windows section into another def. The only real difference
# is where the temp file will be located. Mac & Linux probably should be in /tmp I guess. # is where the temp file will be located. Mac & Linux probably should be in /tmp I guess.
# everything else is linux or mac # everything else is linux or mac