templatefile/cmd/templater.go

24 lines
493 B
Go

package main
import (
"fmt"
"os"
"forge.cadoles.com/pcaseiro/templatefile/pkg/templater"
)
func main() {
// The template to process
templateType := os.Args[1]
templateFile := os.Args[2]
config := []byte(os.Args[3])
if templateType == "go" {
fmt.Printf("%s", templater.ProcessGoTemplate(templateFile, config))
} else if templateType == "hcl" {
fmt.Printf("%s", templater.ProcessHCLTemplate(templateFile, config))
} else {
panic(fmt.Errorf("Unsupported template type"))
}
}