heapwolf / prompt-sync

a synchronous prompt for node.js
MIT License
211 stars 42 forks source link

[request] Set term or set terminating function #30

Closed kyleshrader closed 6 years ago

kyleshrader commented 6 years ago

It would be nice if we could override the termination key, or pass in our own boolean function to determine the case for termination.

yegodz commented 6 years ago

can you describe a use case? what type of character or Boolean function are you thinking of for termination

kyleshrader commented 6 years ago

I was hoping to alter this for a personal tool that would accept multi-line input.

edit: for what it's worth, i ended up just pulling it from the clipboard since my use-case was copy-pasting the input into the script

yegodz commented 6 years ago

yeah .. good point. Only problem is the multiline messes up the line edit mode.. Really hard to enter the newline character and then still handle backspace etc. Easy way to handle would be to simply accept one line at a time until you see a end sequence and just concat the lines received together.