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
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
would i need to use multiple threads, since prompt is blocking?
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