How to add less/more command like pagination in a custom CLI?

258 views Asked by At

I'm building a CLI with Node.js and want to add less/more like pagination.

screenshot

I can just stdout the output and pipe it to less like this

enter image description here

but I'm not able to add the text highlight just like git log in the first picture.

I have searched about it but couldn't find any relevant info. Would really appreciate any help or references

0

There are 0 answers