Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple choices for gum confirm #670

Open
vt-alt opened this issue Sep 8, 2024 · 0 comments
Open

Multiple choices for gum confirm #670

vt-alt opened this issue Sep 8, 2024 · 0 comments

Comments

@vt-alt
Copy link

vt-alt commented Sep 8, 2024

Is your feature request related to a problem? Please describe.
For example I want user not just say yes no but to have additional choice, for example cancel or view details. Triple choice is quite frequent in cli dialogs.

Describe the solution you'd like
Would be good if gum supports multiple choices for gum confirm. To behave similar to gum choose but with horizontal selection menu.

Perhaps it should return exit code with selection number. For example for Yes/No it will be backward compatible 0/1, but for Yes/Details/No it will be 0/1/2 so that No still return non-zero exit code., which is backward compatible again.

Describe alternatives you've considered
There is gum choose but it have a different UI/UX purpose. (And returns different values).

Additional context
Alternatively, this can be an option to gum choose to display option horizontally and return selection text. That way gum choose --horizontal Yes No would simulate gum confirm somehow. But this will require parsing text (and this can introduce mistakes when text is edited but its parser not). Maybe in that case gum choose could have extension to options format, like gum select --horizontal 0=Yes 1=No 4=Cancel and if user selects "Cancel" it will print string "4" instead of "Cancel".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant