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

rename uses of update to upsert (#178)

This commit is contained in:
Darren Schroeder 2022-03-16 19:13:49 -05:00 committed by GitHub
parent 8d713d030e
commit 834959daf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -3,14 +3,14 @@
def "nu-complete cargo bins" [] { def "nu-complete cargo bins" [] {
let $bins = (ls src | where name =~ bin | each { |f| ls -s $f.name } | flatten | where name =~ .rs || type == dir) let $bins = (ls src | where name =~ bin | each { |f| ls -s $f.name } | flatten | where name =~ .rs || type == dir)
if ($bins | length) > 0 { if ($bins | length) > 0 {
echo $bins | update name { |file| $file.name | str find-replace ".rs" "" } | get name echo $bins | upsert name { |file| $file.name | str find-replace ".rs" "" } | get name
} }
} }
def "nu-complete cargo examples" [] { def "nu-complete cargo examples" [] {
let $examples = (ls | where name =~ examples | each { |f| ls -s $f.name } | flatten | where name =~ .rs || type == dir) let $examples = (ls | where name =~ examples | each { |f| ls -s $f.name } | flatten | where name =~ .rs || type == dir)
if ($examples | length) > 0 { if ($examples | length) > 0 {
echo $examples | update name { |file| $file.name | str find-replace ".rs" "" } | get name echo $examples | upsert name { |file| $file.name | str find-replace ".rs" "" } | get name
} }
} }

View file

@ -55,7 +55,7 @@ def timed_weather_run [
Source: "expired-cache" Source: "expired-cache"
Emoji: ($emoji) 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 | upsert 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)"
@ -67,7 +67,7 @@ def timed_weather_run [
Source: "initial" Source: "initial"
Emoji: ($emoji) 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 | upsert 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..." echo "Your command did not run because you are not on Windows..."