Browse Source

Add flag to disable colors in REPL

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
783f5019b0
  1. 4
      lib/repl.js
  2. 1
      src/node.cc

4
lib/repl.js

@ -20,6 +20,8 @@ var fs = require("fs");
var rl = require('readline'); var rl = require('readline');
var context; var context;
var disableColors = process.env.NODE_DISABLE_COLORS ? true : false;
function cwdRequire (id) { function cwdRequire (id) {
if (id.match(/^\.\.\//) || id.match(/^\.\//)) { if (id.match(/^\.\.\//) || id.match(/^\.\//)) {
id = path.join(process.cwd(), id); id = path.join(process.cwd(), id);
@ -54,7 +56,7 @@ function REPLServer(prompt, stream) {
return self.complete(text); return self.complete(text);
}); });
if (rli.enabled) { if (rli.enabled && !disableColors) {
// Turn on ANSI coloring. // Turn on ANSI coloring.
exports.writer = function(obj, showHidden, depth) { exports.writer = function(obj, showHidden, depth) {
return sys.inspect(obj, showHidden, depth, true); return sys.inspect(obj, showHidden, depth, true);

1
src/node.cc

@ -1733,6 +1733,7 @@ static void PrintHelp() {
"NODE_DEBUG Print additional debugging output.\n" "NODE_DEBUG Print additional debugging output.\n"
"NODE_MODULE_CONTEXTS Set to 1 to load modules in their own\n" "NODE_MODULE_CONTEXTS Set to 1 to load modules in their own\n"
" global contexts.\n" " global contexts.\n"
"NODE_DISABLE_COLORS Set to 1 to disable colors in the REPL\n"
"\n" "\n"
"Documentation can be found at http://nodejs.org/api.html" "Documentation can be found at http://nodejs.org/api.html"
" or with 'man node'\n"); " or with 'man node'\n");

Loading…
Cancel
Save