summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2009-09-28 16:50:03 +0200
committerRyan Dahl <ry@tinyclouds.org>2009-09-28 18:48:18 +0200
commitc27d9f986a01b86d30b11fd20a3dbd43251ec13a (patch)
tree40234a5602dd7737932ac2a8c5161b78554cf643
parent459d644a5a99da3aa2b681a25e62c82e89b34710 (diff)
downloadnodejs-c27d9f986a01b86d30b11fd20a3dbd43251ec13a.tar.gz
nodejs-c27d9f986a01b86d30b11fd20a3dbd43251ec13a.tar.bz2
nodejs-c27d9f986a01b86d30b11fd20a3dbd43251ec13a.zip
include utils in the repl.
-rwxr-xr-xbin/node-repl1
-rw-r--r--lib/repl.js16
2 files changed, 9 insertions, 8 deletions
diff --git a/bin/node-repl b/bin/node-repl
index eb2aff31d..ae5ca9d6f 100755
--- a/bin/node-repl
+++ b/bin/node-repl
@@ -1,5 +1,6 @@
#!/usr/bin/env node
+include("/utils.js");
puts("Welcome to the Node.js REPL.");
puts("Enter ECMAScript at the prompt.");
puts("Tip 1: Use 'rlwrap node-repl' for a better interface");
diff --git a/lib/repl.js b/lib/repl.js
index a1fce7f00..10a3e0faf 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -3,7 +3,7 @@
var utils = require("utils.js");
-puts("Type '.help' for options.");
+utils.puts("Type '.help' for options.");
node.stdio.open();
node.stdio.addListener("data", readline);
@@ -54,7 +54,7 @@ function readline (cmd) {
}
} catch (e) {
// On error: Print the error and clear the buffer
- puts('caught an exception: ' + e);
+ utils.puts('caught an exception: ' + e);
buffered_cmd = '';
}
@@ -66,7 +66,7 @@ function readline (cmd) {
* Used to display the prompt.
*/
function displayPrompt () {
- print(buffered_cmd.length ? '... ' : exports.prompt);
+ utils.print(buffered_cmd.length ? '... ' : exports.prompt);
}
/**
@@ -82,7 +82,7 @@ function parseREPLKeyword (cmd) {
displayPrompt();
return true;
case ".clear":
- puts("Clearing Scope...");
+ utils.puts("Clearing Scope...");
buffered_cmd = '';
exports.scope = {};
displayPrompt();
@@ -91,10 +91,10 @@ function parseREPLKeyword (cmd) {
node.stdio.close();
return true;
case ".help":
- puts(".break\tSometimes you get stuck in a place you can't get out... This will get you out.");
- puts(".clear\tBreak, and also clear the local scope.");
- puts(".exit\tExit the prompt");
- puts(".help\tShow repl options");
+ utils.puts(".break\tSometimes you get stuck in a place you can't get out... This will get you out.");
+ utils.puts(".clear\tBreak, and also clear the local scope.");
+ utils.puts(".exit\tExit the prompt");
+ utils.puts(".help\tShow repl options");
displayPrompt();
return true;
}