tornado-repl
v0.12.1
Published
a cli-repl thing
Downloads
2
Maintainers
Readme
deprecated
Simply use node's core readline module.
var fs = require('fs');
var readline = require('readline');
var file = fs.createWriteStream('output.log', 'utf8');
file.write('BEGIN\n');
var repl = readline.createInterface({
input: process.stdin,
output: process.stdout,
completer: function (line) {
var hits = ['completion:'].concat((line || '').split(/\s+/));
return [hits, line];
}
}).on('line', function (line) {
// do something with that line input
file.write(line.trim() + '\n');
repl.prompt();
}).on('SIGINT', function () {
file.end('END');
process.exit(0);
});
repl.prompt();