AlecAivazis / survey

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

Disable MultiSelect answer output #407

Closed browningluke closed 2 years ago

browningluke commented 2 years ago

Hi there, I was wondering if there was a way to disable the confirmation of selected answers.

Using this example, if you were to select all of them, you'd end up with this:

image

I have a use case where I would need to select all (sometimes) from a very long list, so having it print all of the responses like that wouldn't work.

Any advice would be much appreciated!

mislav commented 2 years ago

Good point! I don't think there is a built-in way of disabling this, but you could override this template string from your app and take out the ShowAnswer line: https://github.com/AlecAivazis/survey/blob/3cabaff974060c555ea7d792abbd8272096fa919/select.go#L60

So, in your app:

survey.SelectQuestionTemplate = `...`

After that, Survey Select prompts will use the template that you defined when rendering.

browningluke commented 2 years ago

That works, thank you very much!

I think in my case it would be:

survey.MultiSelectQuestionTemplate = `...`