You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Very often when adding these sort of prompts there's one requirement that always pops up, and that's the ability to turn them off.
Usually it's cases such as trying to get things to automate and questions like "Re-build?" that get in the way. Or it can be just a case of "well I just want to run with defaults, don't want to sit here waiting for the next prompt" (with regard to why not ask upfront, it's because sometimes you dont know the options, the "default" may be just "first of available" or some such logic)
How about having the ability to timeout to a noninteraction default value?
constresponse=awaitprompts({type: 'number',name: 'value',message: 'How old are you?',// a function is prefered, but in this case just "16" would have been fine tooassume: ()=>16,timeout: 4000,// basically: disable entirely, defaults to assume value// convenient if you have some --auto or --non-interactive flag already presentoff: some_boolean_variable_or_function});
Behavior would be:
if the shell is detected to be non-interactive then the noninteraction value is just instantly applied
if any sort of interaction happens then the noninteraction timeout disabled completely
there are some checks for the interaction to be meaningful (garbage characters or signals are treated as just noise)
a small countdown appears when it's in the last 3s before it just triggers non-interaction
The text was updated successfully, but these errors were encountered:
Hi @srcspider. Thanks for the suggestion. I think this is similar to #47 and #22. I'm working on better handling of default values. In the future it might be possible to programmatically resolve/reject prompts in their onState callback. There's also most likely going to be a validate function that allows similar functionality (#2)
But just want to emphasize, since all 3 of the issues you linked don't directly mention or imply it as much. The most important part (for me) is that it needs to be "robot friendly." In other words turning any script that uses the library into a completely automated one should be super easy.
Very often when adding these sort of prompts there's one requirement that always pops up, and that's the ability to turn them off.
Usually it's cases such as trying to get things to automate and questions like "Re-build?" that get in the way. Or it can be just a case of "well I just want to run with defaults, don't want to sit here waiting for the next prompt" (with regard to why not ask upfront, it's because sometimes you dont know the options, the "default" may be just "first of available" or some such logic)
How about having the ability to timeout to a noninteraction default value?
Behavior would be:
The text was updated successfully, but these errors were encountered: