Created
April 10, 2013 19:52
-
-
Save sspencer/5357871 to your computer and use it in GitHub Desktop.
Simple standalone NodeJS REPL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple embedded REPL | |
var repl = require("repl"); | |
repl.start({ | |
prompt: "karma> ", | |
input: process.stdin, | |
output: process.stdout, | |
eval: function(cmd, context, filename, callback) { | |
// cmd comes thru as "(ls\n)", get back to original "ls" | |
callback("You typed: " + cmd.substring(1, cmd.length-1).trim()); | |
}, | |
writer: function(object) { | |
return String(object); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment