Skip to content

Commit

Permalink
Handle variable scope for default values correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rgeyer authored and 6uhrmittag committed Oct 2, 2021
1 parent 66b8ce0 commit 05ade73
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ func (t *dirTemplate) UseDefaultValues() {
}

func (t *dirTemplate) BindPrompts() {
for s, v := range t.Context {
for s, ov := range t.Context {
var v = ov
if m, ok := v.(map[string]interface{}); ok {
advancedMode := prompt.New(s, false)

for k, v2 := range m {
for k, ov2 := range m {
var v2 = ov2
if t.ShouldUseDefaults {
t.FuncMap[k] = func() interface{} {
switch v2 := v2.(type) {
Expand Down

0 comments on commit 05ade73

Please sign in to comment.