Monday 24 February 2020

How to create zsh like behavior in a Node CLI app?

I am writing a CLI app with Node. What I want to be able to do is use the up arrow key to go through a command history and allow the user to edit the command.Another example: There is a zsh plugin that will highlight a command in green if it is a valid command, as you type it. I imagine this involves re-writing the user's input with some control codes to make part of the text green.I'm using the readline module to read user input in the Node app, is there a way to get behavior like this?I guess basically what I'm trying to do is alter the command being typed in some way.

Submitted February 24, 2020 at 07:33PM by thinksInCode

No comments:

Post a Comment