Add templates for air.
This commit is contained in:
13
templates.go
13
templates.go
@ -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")
|
||||
}
|
||||
|
Reference in New Issue
Block a user