aboutsummaryrefslogtreecommitdiff
path: root/script_example_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-08-11 16:56:50 +0700
committerShulhan <ms@kilabit.info>2021-08-22 17:23:15 +0700
commitdb5c26d8f61aa0fedc5854b649f7914054397a81 (patch)
tree9fb0ac785f16fb0ea990d98dfdf66b6b8248e4dd /script_example_test.go
parent45485c7232e95acbe7b6ffbe31c9f40ca17ea774 (diff)
downloadawwan-db5c26d8f61aa0fedc5854b649f7914054397a81.tar.xz
all: rewrite the Session and Script using Statement
The idea for rewrite is to separate between local and remote script, so we can apply environment variables to local script. We also parse and validate each statements before being executed to simplify the code.
Diffstat (limited to 'script_example_test.go')
-rw-r--r--script_example_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/script_example_test.go b/script_example_test.go
index 94cd23c..b9e3735 100644
--- a/script_example_test.go
+++ b/script_example_test.go
@@ -9,7 +9,7 @@ import (
"log"
)
-func ExampleScript_join() {
+func ExampleParseScriptForLocal() {
envContent := `
[section]
key=value
@@ -26,12 +26,12 @@ end;
log.Fatal(err)
}
- s, err := ParseScript(ses, []byte(scriptContent))
+ s, err := ParseScriptForLocal(ses, []byte(scriptContent))
if err != nil {
log.Fatal(err)
}
- for _, stmt := range s.statements {
+ for _, stmt := range s.rawLines {
fmt.Printf("%s\n", stmt)
}
// Output: