Files
mgmt/examples/lang/env0.mcl
James Shubin 43839d1090 all: Switch the --lang syntax to use argv instead
It was a bit awkward using `mgmt run lang --lang <input>` so instead, we
now drop the --lang, and read the positional argv for the input.

This also does the same for the --yaml frontend.
2019-05-05 11:10:47 -04:00

24 lines
568 B
Plaintext

# read and print environment variable
# env TEST=123 EMPTY= ./mgmt run --tmp-prefix --converged-timeout=5 lang examples/lang/env0.mcl
import "fmt"
import "sys"
$x = sys.getenv("TEST", "321")
print "print1" {
msg => fmt.printf("the value of the environment variable TEST is: %s", $x),
}
$y = sys.getenv("DOESNOTEXIT", "321")
print "print2" {
msg => fmt.printf("environment variable DOESNOTEXIT does not exist, defaulting to: %s", $y),
}
$z = sys.getenv("EMPTY", "456")
print "print3" {
msg => fmt.printf("same goes for epmty variables like EMPTY: %s", $z),
}