Files
mgmt/examples/lang/datetime2.mcl
2025-05-04 13:54:45 -04:00

19 lines
425 B
Plaintext

import "datetime"
import "golang"
import "sys"
$now = datetime.now()
$st = struct{now => $now, load => $load,}
$load float = sys.load()->x1 # ambiguous so we specify the type!
file "/tmp/mgmt/datetime" {
state => $const.res.file.state.exists,
content => golang.template("Hello! It is now: {{ datetime_print .now }}\n\nload average: {{ .load }}\n", $st),
}
file "/tmp/mgmt/" {
state => $const.res.file.state.exists,
}