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

Adding footer message to Survey #435

Closed vhvb1989 closed 1 year ago

vhvb1989 commented 1 year ago

Looking to have a feature like the one proposed in this PR where I can add a footer message as a hint that there are more items in the survey.

Related to: https://github.com/Azure/azure-dev/issues/66

I am adding only the support for Select. If this idea and implementation would be OK, I could update multi-select and create some test cases.

mislav commented 1 year ago

Thanks for proposing this!

I'm wary of adding a new overly-specific configuration option. Generally, if there was a way to indicate more items below or after the "fold", I'd be into that, but I would like to see this generalized solution built into the current configuration around pagination, and not being called something vague like a "footer".

Until this feature is available in Survey, would it be an option for your app to customize the template string to add the "below the fold" indicator? I'm thinking that you might not need to make any changes to Survey in order to override this string in your app https://github.com/AlecAivazis/survey/blob/e47352f914346a910cc7e1ca9f65a7ac0674449a/select.go#L69-L85

vhvb1989 commented 1 year ago

Thanks for proposing this!

I'm wary of adding a new overly-specific configuration option. Generally, if there was a way to indicate more items below or after the "fold", I'd be into that, but I would like to see this generalized solution built into the current configuration around pagination, and not being called something vague like a "footer".

Until this feature is available in Survey, would it be an option for your app to customize the template string to add the "below the fold" indicator? I'm thinking that you might not need to make any changes to Survey in order to override this string in your app

https://github.com/AlecAivazis/survey/blob/e47352f914346a910cc7e1ca9f65a7ac0674449a/select.go#L69-L85

Thank you @mislav I have explored the template-override approach, but the template logic becomes extra complicated as it needs to figure it out if the last item from .Select.Options is in .PageEntries !!
It would be much simpler if this information is returned by paginate() fn and passed to SelectTemplateData. Then the template can show the footer message only when user is not seeing the last page.

AlecAivazis commented 1 year ago

I'm going to close this PR since it's gone a bit stale. I agree we want something like this in general so let's try to figure out what the right API is that gives us a little more flexibility than a fixed string. For example, I'd like to be able to say 5 more at the bottom. I've opened https://github.com/AlecAivazis/survey/issues/453 for that discussion