Add templates for air.

This commit is contained in:
2024-09-03 14:38:02 +02:00
parent 7f25c3f83c
commit 93338b0712
4 changed files with 106 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"text/template"
"github.com/Iilun/survey/v2"
@ -21,6 +22,12 @@ var dockerImage string
//go:embed templates/Dockerfile
var dockerFile string
//go:embed templates/.air.toml
var airToml string
//go:embed templates/.air.win.toml
var airWinToml string
var qs = []*survey.Question{
{
Name: "tpl",
@ -63,6 +70,12 @@ func tplAction(ctx *cli.Context) error {
case "Dockerfile":
tpl = dockerFile
fileName = "Dockerfile"
case "air.toml":
tpl = airToml
if runtime.GOOS == "windows" {
tpl = airWinToml
}
fileName = ".air.toml"
default:
golog.Fatal("Invalid template")
}