node.js - Is there a way to enable paging in node js REPL -


i see paging when have long outputs in node js repl.

is possible, how?

vorpal.js node module looks trick. vorpal turns node app interactive cli, , supports extensions including implementation of less command in node.

something work:

var vorpal = require('vorpal')(); var less = require('vorpal-less');  vorpal   .catch('[commands...]')   .action(function (args, cb) {     args.commands = args.commands || [];     var cmd = args.commands.join(' ');     var res;     try {       res = eval(cmd);     } catch(e) {       res = e;     }     this.log(res);     cb();   });  vorpal   .delimiter('myrepl>')   .show(); 

this turn application repl within context of app, can accept less command:

$ node myrepl.js myrepl> 6 * 6 | less  36  : (less prompt) 

disclaimer: wrote vorpal


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -