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
Post a Comment