Closed kke closed 7 years ago
That sounds like a good addition. Because this makes the prompt pause
I would suggest the following api:
prompt.pause('Press any key to continue')
I also think it would provide higher flexibility to provide ability to specify keys that match already implemented key event names. By default any key would do the trick but you could ask user for specific confirmation.
prompt.pause('Press space or enter to continue', keys: [:space, :enter])
I would probably replace the countdown
option with timeout
as more generally understood convention:
prompt.pause('Press any key to continue', timeout: 10)
What do you think?
ps. I will schedule that for implementation for next release after Windows support is out of the door. I prefer to release more frequently.
Yes pause is good.
I went with already existing #keypress
api as it seemed very appropriate and saved me introducing new types of prompts. It now support :keys
and :timeout
options. Please read docs and try out example. I've even introduced :countdown
token so you can create any question you wish that includes automatic time countdown. Enjoy!
Released v0.12.0
that includes new implementation for keypress
. Enjoy!
Something like:
any_key('Somethings about to happen, press any key to continue')
and with countdown:
any_key('Somethings about to happen, press any key to continue, continuing automatically in...', countdown: 10)
(which would continue automatically once the countdown reaches zero)