$ cnpm install pretty-repl
An extension of the Node REPL (repl.REPLServer
) that applies syntax highlighting as the user types.
Install the package:
$ npm install --save pretty-repl
Use the package:
const repl = require('pretty-repl');
const options = {
prompt: '→ '
};
repl.start(options);
options
is an an object with the same options as repl.REPLServer
.
Additionally, it's possible to pass an additional colorize
property to the options object:
{
colorize: function (str) {
// str is the the string in input.
// the function should return the string that has been colorized to output in the REPL.
}
}
readline
module). If you use readline
(or a module that depends on it) somewhere else, you may want to test everything thoroughly. In theory, there should be no side effects.Pretty repl is inspired and includes code fragments from:
Copyright 2014 - 2017 © taobao.org |