Skip to content

Instantly share code, notes, and snippets.

@pvencill
Created June 16, 2014 13:14
Show Gist options
  • Save pvencill/27790e3850817605d58b to your computer and use it in GitHub Desktop.
Save pvencill/27790e3850817605d58b to your computer and use it in GitHub Desktop.
Basic use of a custom REPL in Node
'use strict';
var repl = require('repl'),
pkg = require('../package.json');
var r = repl.start({
prompt: pkg.name + ' >',
input : process.stdin,
output: process.stdout
});
r.context.howdy = function(){ console.log('Howdy');
r.on('exit', process.exit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment