aboutsummaryrefslogtreecommitdiff
path: root/script_example_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-05-27 21:57:42 +0700
committerShulhan <m.shulhan@gmail.com>2019-10-26 01:09:02 +0700
commite65eeae6515fad9d6861df184035c9f656a02848 (patch)
treeb171066d345901b3a9b219872bd748af5a0ab96d /script_example_test.go
downloadawwan-e65eeae6515fad9d6861df184035c9f656a02848.tar.xz
awwan: the configuration management for local and cloud
awwan is command line interface to configurate and manage remote system through SSH connection.
Diffstat (limited to 'script_example_test.go')
-rw-r--r--script_example_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/script_example_test.go b/script_example_test.go
new file mode 100644
index 0000000..472f439
--- /dev/null
+++ b/script_example_test.go
@@ -0,0 +1,35 @@
+// Copyright 2019, Shulhan <ms@kilabit.info>. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package awwan
+
+import (
+ "fmt"
+)
+
+func Examplescript_join() {
+ envContent := `
+[section]
+key=value
+`
+
+ scriptContent := `
+multiline\
+command {{.Val "section::key"}};\
+end;
+`
+ env := &Environment{}
+ env.parseEnvironment([]byte(envContent))
+
+ s := parseScript(env, []byte(scriptContent))
+
+ for _, stmt := range s.Statements {
+ fmt.Printf("%s\n", stmt)
+ }
+ // Output:
+ //
+ // multiline command value; end;
+ //
+ //
+}