summaryrefslogtreecommitdiffstats
path: root/main.go
blob: ce586791bf4e7f8bd56c4918c7bb89d9ca4b6984 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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)
}
remember that computers suck.