Skip to content

Commit

Permalink
Add a command-line argument to select the template (#14)
Browse files Browse the repository at this point in the history
Right now the only option is "basic" but we may add more soon.
  • Loading branch information
lfritz authored Feb 27, 2024
1 parent c7e5b98 commit 39510fe
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@ import (
"io/fs"
"log"
"os"
"path"
"strings"
"text/template"
)

//go:embed templates/basic/*
//go:embed templates/*
var templates embed.FS

func main() {
name := ""
group := ""
templateName := ""

flag.StringVar(&group, "group", "", "group of the service, like 'enrichment' or 'synthplatform', etc")
flag.StringVar(&name, "name", "", "name of the service")
flag.StringVar(&templateName, "template", "basic", "name of the template")
flag.Parse()

if name == "" || group == "" {
Expand All @@ -29,17 +32,17 @@ func main() {
os.Exit(1)
}

generate(name, group)
generate(name, group, templateName)
}

func generate(name, group string) {
func generate(name, group, templateName string) {
type serviceInfo struct {
Name string
Group string
ConfigPrefix string
}

const templateDir = "templates/basic"
templateDir := path.Join("templates", templateName)

info := serviceInfo{
Name: name,
Expand Down

0 comments on commit 39510fe

Please sign in to comment.