Files
mgmt/examples/lang/history1.mcl
James Shubin b8f8ec8aa3 lang: parser, funcs: Take out the built-in history function
It's a normally named function for now, until we think of a common
package to move it into.

Hopefully this makes improving the lexer and parser easier for now. We
can consider bringing it back if needed.
2023-10-09 17:19:08 -04:00

11 lines
442 B
Plaintext

import "datetime"
$dt = datetime.now()
$hystvalues = {"ix0" => $dt, "ix1" => history($dt, 1), "ix2" => history($dt, 2), "ix3" => history($dt, 3),}
file "/tmp/mgmt/history" {
state => $const.res.file.state.exists,
content => template("Index(0) {{.ix0}}: {{ datetime_print .ix0 }}\nIndex(1) {{.ix1}}: {{ datetime_print .ix1 }}\nIndex(2) {{.ix2}}: {{ datetime_print .ix2 }}\nIndex(3) {{.ix3}}: {{ datetime_print .ix3 }}\n", $hystvalues),
}