AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.08k stars 350 forks source link

survey.Select to return custom type #238

Closed dgkanatsios closed 5 years ago

dgkanatsios commented 5 years ago

I would like to have survey.Select return a custom type, so I can assign it to my result struct. I thought I could use the Transform field to do that, but it seems that it expects me to return a core.OptionAnswer value. Is this correct? If it is, what's the point of having Transformer return interface{}? Thanks!

AlecAivazis commented 5 years ago

Hey @dgkanatsios - thanks for opening this issue.

Please #105 for more context on the select API. In short, I know its not ideal but atm the API does not allow what you want. There is a lot of discussion around what the right API is and not a lot of movement so I decided to leave things as they are today.

Sorry if that's not the answer you were looking for!

luisdavim commented 1 year ago

I have the same use case :(