examples: lang: Update examples to fix imports and port from yaml

Some small fixes that are useful for demos!
This commit is contained in:
James Shubin
2019-02-01 03:47:18 -05:00
parent 5d0efce278
commit 78936c5ce8
4 changed files with 52 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import "datetime"
import "sys"
import "example"
$secplusone = datetime.now() + $ayear
@@ -10,7 +11,7 @@ $tmplvalues = struct{year => $secplusone, load => $theload, vumeter => $vumeter,
$theload = structlookup(sys.load(), "x1")
$vumeter = vumeter("====", 10, 0.9)
$vumeter = example.vumeter("====", 10, 0.9)
file "/tmp/mgmt/datetime" {
content => template("Now + 1 year is: {{ .year }} seconds, aka: {{ datetime_print .year }}\n\nload average: {{ .load }}\n\nvu: {{ .vumeter }}\n", $tmplvalues),