diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -0,0 +1,31 @@ +package main + +import ( + "os" + "fmt" + "html/template" + "github.com/goccy/go-yaml" +) + +func check(e error) { + if e != nil { + fmt.Println(e) + panic(e) + } +} + +func main() { + template_file, err := os.ReadFile(os.Args[1]) + check(err) + + data_file, err := os.ReadFile(os.Args[2]) + check(err) + + template_obj, err := template.New("template").Parse(string(template_file)) + check(err) + + data_raw, err := yaml.Marshal(string(data_file)) + check(err) + + template_obj.Execute(os.Stdout, data_raw) +} |