diff --git a/DOCS.md b/DOCS.md index 57ffe318192a6bc35ca05e5bfc85555c1ceb32dc..889b7f0c14d2300a38eda9b9e92d2970e668f0de 100644 --- a/DOCS.md +++ b/DOCS.md @@ -11,10 +11,6 @@ 2. A `template` directory that serves as the "root" of the template. ## template.toml -**NOTE:** The template.toml file will be expanded, though not with the full power of the template itself. -The template.toml file will only expand environment variables with syntax `$USER` or `${USER}`. -For full documentation on the syntax, see [os.ExpandEnv](https://golang.org/pkg/os/#ExpandEnv). - ```toml # Key-value pairs can be simple # The user will receive a basic prompt asking them to fill out the variable @@ -29,7 +25,7 @@ prompt = "The name of the author of this project" # help would be extra information (generally seen by giving '?' to a prompt) help = "Who will be primarily writing this project" # default is the "value" part of the simple pair. This could be a suggested value -default = "$USER" +default = "me" ``` ## template directory diff --git a/registry/prompt.go b/registry/prompt.go index dfa47cecf78e26359c0cb42b4eb4057421f4a77e..b683205df5a629705312d4ad1b5063a3af76ee8d 100644 --- a/registry/prompt.go +++ b/registry/prompt.go @@ -2,7 +2,6 @@ package registry import ( "fmt" - "io/ioutil" "os" "path/filepath" "sort" @@ -26,16 +25,7 @@ if _, err := os.Lstat(templatePath); err != nil { return nil, err } - templateBytes, err := ioutil.ReadFile(templatePath) - if err != nil { - return nil, err - } - - // Expand the template with environment variables - templateContents := os.ExpandEnv(string(templateBytes)) - - "text/template" if err != nil { return nil, err } diff --git a/registry/template_test.go b/registry/template_test.go index 11f2d0f3548374aba8c3218c464e562af160d079..be32ced12b454cee374abb3fed0f5829aa1c1eb4 100644 --- a/registry/template_test.go +++ b/registry/template_test.go @@ -12,7 +12,7 @@ tmplContents = `{{title name}} {{.year}}` tmplTemplate = `name = "john olheiser" [year] -default = ${TMPL_TEST} +default = 2020 [package] default = "pkg"` @@ -21,12 +21,6 @@ tmplNewGold = "DO NOT OVERWRITE!" ) func testExecute(t *testing.T) { - // Set environment variable - if err := os.Setenv("TMPL_TEST", "2020"); err != nil { - t.Logf("could not set environment: %v", err) - t.FailNow() - } - // Get template tmpl, err := reg.GetTemplate("test") if err != nil {