Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Fix default input display #314

Merged
merged 2 commits into from
Nov 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion input.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,20 @@ func (i *Input) Prompt(config *PromptConfig) (interface{}, error) {
}

func (i *Input) Cleanup(config *PromptConfig, val interface{}) error {
// use the default answer when cleaning up the prompt if necessary
ans := i.answer
if ans == "" && i.Default != "" {
ans = i.Default
}

// render the cleanup
return i.Render(
InputQuestionTemplate,
InputTemplateData{
Input: *i,
ShowAnswer: true,
Config: config,
Answer: i.answer,
Answer: ans,
},
)
}