package main
import (
"html/template"
"log/slog"
"os"
)
func CreateDirectoryInPackageDir(doc yaml) {
location := doc.LOCATION
slog.Debug("Creating the Directory: ", location)
direrr := os.MkdirAll(location, 0764)
if direrr != nil {
slog.Error(direrr.Error())
}
}
func CreateYaml(doc yaml) {
template, err := template.ParseFiles("YamlTemplates/template.yaml")
yamlFile, _:= os.OpenFile(doc.LOCATION+"/"+doc.PUB+"."+doc.NAME+".yaml", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
slog.Debug("Create the basic yaml")
if err != nil {
slog.Error(err.Error())
}
err = template.ExecuteTemplate(yamlFile, "yaml", doc)
if err != nil {
slog.Error(err.Error())
}
}