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

Prompt time out #368

Open
arivictor opened this issue Aug 11, 2022 · 0 comments
Open

Prompt time out #368

arivictor opened this issue Aug 11, 2022 · 0 comments

Comments

@arivictor
Copy link

arivictor commented Aug 11, 2022

Describe the solution you'd like

I would like to have a prompt that has a TTL/timeout with a visual countdown, the user has N seconds/minutes to provide an input before the process exits.

I'd like to be able to do this, as I prompt a user Are you sure? before proceeding with a destructive change to a remote data store. However, consider the scenario where the user never provides an input and the prompt hangs (they go to get a coffee and forget). It's quite possible that the original information they were acting on is now wrong (i.e. the data store has since been updated). I want to narrow the window of how long the prompt can hang.

Describe alternatives you've considered

I've attempted to use the built in functionality of prompt combined with timeouts and intervals but I just can't seem to get a good UX. I can make the prompt timeout but I can't visualise that to the user with a countdown that dynamically updates:

? Are you sure? › (y/N)

App will exit in: 5 sec

Example

From charmbraclets bubbletea TUI package on Go

image

https://github.com/charmbracelet/bubbletea

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