Skip to content

Commit

Permalink
Merge pull request #134 from rguptar/defaults
Browse files Browse the repository at this point in the history
[fix] Ensure last prompt gets default value
  • Loading branch information
davidgamero authored Aug 15, 2022
2 parents 20dd635 + 45e8568 commit 55390d1
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pkg/prompts/prompts.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ func RunPromptsFromConfig(config *config.DraftConfig) (map[string]string, error)
if err != nil {
return nil, err
}
// Substitute the default value for variables where the user didn't enter anything
for _, variableDefault := range config.VariableDefaults {
if inputs[variableDefault.Name] == "" {
inputs[variableDefault.Name] = variableDefault.Value
}
}
inputs[prompt.OverrideString] = input
}

Expand All @@ -80,15 +74,16 @@ func RunPromptsFromConfig(config *config.DraftConfig) (map[string]string, error)
if err != nil {
return nil, err
}
// Substitute the default value for variables where the user didn't enter anything
for _, variableDefault := range config.VariableDefaults {
if inputs[variableDefault.Name] == "" {
inputs[variableDefault.Name] = variableDefault.Value
}
}
inputs[prompt.OverrideString] = input
}

// Substitute the default value for variables where the user didn't enter anything
for _, variableDefault := range config.VariableDefaults {
if inputs[variableDefault.Name] == "" {
inputs[variableDefault.Name] = variableDefault.Value
}
}

return inputs, nil
}

Expand Down

0 comments on commit 55390d1

Please sign in to comment.