lang: funcs: Rename the lookup functions

This will make things more consistent with future use.
This commit is contained in:
James Shubin
2023-10-11 19:53:25 -04:00
parent 1dc6ebbffc
commit d1c15bd0b7
13 changed files with 78 additions and 81 deletions

View File

@@ -2,7 +2,7 @@ import "fmt"
import "sys"
$env = sys.env()
$m = maplookup($env, "GOPATH", "")
$m = map_lookup_optional($env, "GOPATH", "")
print "print0" {
msg => if sys.hasenv("GOPATH") {

View File

@@ -2,13 +2,13 @@ import "fmt"
$m = {"k1" => 42, "k2" => 13,}
$found = maplookup($m, "k1", 99)
$found = map_lookup_optional($m, "k1", 99)
print "print1" {
msg => fmt.printf("found value of: %d", $found),
}
$notfound = maplookup($m, "k3", 99)
$notfound = map_lookup_optional($m, "k3", 99)
print "print2" {
msg => fmt.printf("notfound value of: %d", $notfound),

View File

@@ -3,7 +3,7 @@ import "world"
$ns = "estate"
$exchanged = world.kvlookup($ns)
$state = maplookup($exchanged, $hostname, "default")
$state = map_lookup_optional($exchanged, $hostname, "default")
exec "exec0" {
cmd => "echo hello world && echo goodbye world 1>&2", # to stdout && stderr

View File

@@ -2,7 +2,7 @@ import "world"
$ns = "estate"
$exchanged = world.kvlookup($ns)
$state = maplookup($exchanged, $hostname, "default")
$state = map_lookup_optional($exchanged, $hostname, "default")
if $state == "one" or $state == "default" {