aboutsummaryrefslogtreecommitdiff
path: root/script_example_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-08-08 23:30:17 +0700
committerShulhan <ms@kilabit.info>2021-08-09 10:38:22 +0700
commit48c1cd3d6700bd13dc1ac8f9ad0c2b655e30e570 (patch)
treedeaa404645d31c907a4481dce38dbcf1692c48a2 /script_example_test.go
parentc3b239bbeb087dd454f548b1e4aaf9b3a4c8e324 (diff)
downloadawwan-48c1cd3d6700bd13dc1ac8f9ad0c2b655e30e570.tar.xz
all: refactoring the code
Previously we have Command, environment, and script types to handle all functionalities. The name for Command is kind a misleading, because it contains method to copy files in local or remote and to execute script in local or remote. This refactoring break down the types into Awwan, Session, and Script. Awwan contains cache of sessions and cache of environment files. Session manage and cache SSH client and list of scripts. One session have one SSH client, but may contains more than one script. Script define the content of ".aww" file, line by line.
Diffstat (limited to 'script_example_test.go')
-rw-r--r--script_example_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/script_example_test.go b/script_example_test.go
index e8407bc..12bac7f 100644
--- a/script_example_test.go
+++ b/script_example_test.go
@@ -9,7 +9,7 @@ import (
"log"
)
-func Examplescript_join() {
+func ExampleScript_join() {
envContent := `
[section]
key=value
@@ -20,13 +20,13 @@ multiline\
command {{.Val "section::key"}};\
end;
`
- env := &environment{}
- err := env.parse([]byte(envContent))
+ ses := &Session{}
+ err := ses.loadEnvFromBytes([]byte(envContent))
if err != nil {
log.Fatal(err)
}
- s, err := parseScript(env, []byte(scriptContent))
+ s, err := ParseScript(ses, []byte(scriptContent))
if err != nil {
log.Fatal(err)
}