mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 15:17:47 +00:00
update output to records
This commit is contained in:
parent
5c1c47b207
commit
0a3fdc57ab
1 changed files with 16 additions and 4 deletions
|
@ -36,7 +36,11 @@ def timed_weather_run [
|
||||||
# $"interval not met. last_runtime: [($last_runtime)](char nl)"
|
# $"interval not met. last_runtime: [($last_runtime)](char nl)"
|
||||||
let temp = ($last_runtime_data.Temperature)
|
let temp = ($last_runtime_data.Temperature)
|
||||||
let emoji = ($last_runtime_data.Emoji)
|
let emoji = ($last_runtime_data.Emoji)
|
||||||
$"Cached Temp: ($temp) Cached Emoji: ($emoji)"
|
{
|
||||||
|
Temperature: ($temp)
|
||||||
|
Source: "cache"
|
||||||
|
Emoji: ($emoji)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
# save the run time and run the command
|
# save the run time and run the command
|
||||||
# $"interval met, running command: [($command)](char nl)"
|
# $"interval met, running command: [($command)](char nl)"
|
||||||
|
@ -46,15 +50,23 @@ def timed_weather_run [
|
||||||
let weather_table = (if $command == "get_weather" {(get_weather)})
|
let weather_table = (if $command == "get_weather" {(get_weather)})
|
||||||
let temp = ($weather_table.Temperature)
|
let temp = ($weather_table.Temperature)
|
||||||
let emoji = ($weather_table.Emoji)
|
let emoji = ($weather_table.Emoji)
|
||||||
$"Temp: ($temp) Emoji: ($emoji)"
|
{
|
||||||
|
Temperature: ($temp)
|
||||||
|
Source: "expired-cache"
|
||||||
|
Emoji: ($emoji)
|
||||||
|
}
|
||||||
$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 {
|
||||||
$"Unable to find [($weather_runtime_file)], creating it(char nl)"
|
# $"Unable to find [($weather_runtime_file)], creating it(char nl)"
|
||||||
let weather_table = (get_weather)
|
let weather_table = (get_weather)
|
||||||
let temp = ($weather_table.Temperature)
|
let temp = ($weather_table.Temperature)
|
||||||
let emoji = ($weather_table.Emoji)
|
let emoji = ($weather_table.Emoji)
|
||||||
$"Created Temp: ($temp) Created Emoji: ($emoji)"
|
{
|
||||||
|
Temperature: ($temp)
|
||||||
|
Source: "initial"
|
||||||
|
Emoji: ($emoji)
|
||||||
|
}
|
||||||
$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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue