Skip to content

Node.js 'readline' alternative with support for coloured syntax highlighting and suggestions

License

Notifications You must be signed in to change notification settings

aantthony/node-color-readline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-color-readline

Node.js 'readline' alternative with support for coloured syntax highlighting and suggestions.

npm install --save node-color-readline

Usage:

var colorReadline = require('node-color-readline');
var chalk = require('chalk');
var repl = colorReadline.createInterface({
  input: process.stdin,
  output: process.stdout,
  colorize: function (str) {
    // Make all occurences of 'e' red.
    return str.replace(/e/g, function (match) {
      return chalk.red(match);
    });
  }
});

repl.on('line', function (cmd) {
  console.log('LINE:', cmd);
});

repl.prompt();

Screenshot

About

Node.js 'readline' alternative with support for coloured syntax highlighting and suggestions

Resources

License

Stars

Watchers

Forks

Packages

No packages published