Skip to content

Instantly share code, notes, and snippets.

@aredridel
Forked from larzconwell/gist:4013950
Created November 4, 2012 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aredridel/4013966 to your computer and use it in GitHub Desktop.
Save aredridel/4013966 to your computer and use it in GitHub Desktop.
var repl = require('repl')
, rl;
rl = repl.start({
prompt: '>>> '
, input: process.stdin
, output: process.stdout
});
rl.on('close', function () {
console.log('Exiting...');
process.exit(0);
});
rl.commands['.foo'] = {
help: "Foo",
action: function() { console.log('Foo') }
};
console.log(rl.commands) // List of predefined commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment