summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2024-07-09 10:04:00 +0200
committerRomain Gonçalves <me@rgoncalves.se>2024-07-09 10:07:47 +0200
commit28d5c1c212a06d599160f96cbe0e6c88840ab367 (patch)
treee3504a070c0b212c93db5251c54b324c3ff39380 /main.go
downloadinvoiceg-28d5c1c212a06d599160f96cbe0e6c88840ab367.tar.gz
inittrunk
Diffstat (limited to 'main.go')
-rw-r--r--main.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..ce58679
--- /dev/null
+++ b/main.go
@@ -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)
+}
remember that computers suck.