oatmealgrips
oatmealgrips•3w ago

making a cli with arrow keys for navigating prior commands

How would one do this with Deno? I've tried messing with "prompt" and Deno.stdin, but I can't seem to figure it out, nor can I find examples online
3 Replies
marvinh.
marvinh.•3w ago
The secret is ansi codes which are special character combinations in terminals that allow you to clear previous lines or move the cursor, see https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html
oatmealgrips
oatmealgripsOP•3w ago
would i need to use multiple threads, since prompt is blocking?
Mrcool 🇵🇸
you should not use prompt because of its blocking behavior you can use node:readline directly or checkout how libraries like https://cliffy.io/docs@v1.0.0-rc.7/prompt do terminal manipulations

Did you find this page helpful?