Files
moxa/_test/gen_example.sh
Ludovic Fernandez 3c674c2cc4 fix: remove hardcoded port. (#27)
* fix: remove hardcoded port.

* fix: genop.
2019-01-22 15:31:28 +01:00

29 lines
525 B
Bash
Executable File

#!/bin/sh
export LANG=C
echo '// Code Generated by ../_test/gen_example.sh. DO NOT EDIT.'
echo
echo 'package interp'
echo
echo 'import "github.com/containous/dyngo/stdlib"'
echo
for file in *.go
do
awk '
$0 == "// Output:" { done = 1 }
{ if (done) out = out "\n" $0; else src = src "\n" $0 }
END {
print "func Example_'${file%.*}'() {"
print "src := `" src "`"
print "i := New(Opt{Entry: \"main\"})"
print "i.Use(stdlib.Value, stdlib.Type)"
print "i.Eval(src)"
print out
print "}"
}
' $file
echo
done