AlecAivazis / survey

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

Make survey/core customizations per-question #192

Closed ahmetb closed 5 years ago

ahmetb commented 5 years ago

It looks like to change something like the ErrorIcon or QuestionIcon, I must do

core.QuestionIcon = ...

This isn't great since it effects every part of my program globally, and might have side-effects that I can't easily find out.

I would've preferred more if the output customizations are per-question based, such as encapsulated in a survey.AskOpts implementation so that I can do.

survey.AskOne(&survey.Select{...}, &v, &survey.QuestionOpts{QuestionIcon: ...})

instead of setting a global variable.

AlecAivazis commented 5 years ago

I'm going to close this in favor of #201 where I am tracking all of the different places where this sort of refactor should happen. This work is currently being done in the ask-opts branch if you want to track it