fix(init): support OptionAnswer form in survey/v2 (#113)

This commit is contained in:
Derek Smith 2021-03-09 03:21:47 -06:00 committed by GitHub
parent efa1c30c0a
commit 8713d96856
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,8 +81,11 @@ func (q *questionerImpl) ask() (*Answer, error) {
tpls := q.getPreviewableList(templates)
var previewableTransform = func(ans interface{}) (newAns interface{}) {
if s, ok := ans.(string); ok {
newAns = q.parsePreviewableList(s)
if s, ok := ans.(survey.OptionAnswer); ok {
newAns = survey.OptionAnswer{
Value: q.parsePreviewableList(s.Value),
Index: s.Index,
}
}
return
}