From d4bfae7d10e5b1e3740ca888f9e001cc2a1c3870 Mon Sep 17 00:00:00 2001 From: Patrick Stadler Date: Wed, 4 Feb 2015 19:12:21 +0100 Subject: [PATCH] fix Transport#prompt() to handle --no-color (fixes #70) --- lib/index.js | 5 +++-- lib/logger/index.js | 4 ---- lib/transport/index.js | 1 + 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/index.js b/lib/index.js index 4ed2a6a..846e89c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5,7 +5,8 @@ var format = require('util').format , logger = require('./logger')() , errors = require('./errors') , flight = require('./flight') - , prettyTime = require('pretty-hrtime'); + , prettyTime = require('pretty-hrtime') + , chalk = require('chalk'); var DEFAULT_TASK = 'default'; @@ -312,7 +313,7 @@ Flightplan.prototype.run = function(task, target, options) { options = options || {}; if(options.color !== undefined) { - logger.useColors(options.color); + chalk.enabled = options.color; } if(Object.keys(this._targets).indexOf(target) === -1) { diff --git a/lib/logger/index.js b/lib/logger/index.js index e3f0624..faad13a 100644 --- a/lib/logger/index.js +++ b/lib/logger/index.js @@ -24,10 +24,6 @@ function Logger(options) { } } -Logger.prototype.useColors = function(flag) { - chalk.enabled = flag; -}; - Logger.prototype.user = function(message) { this._log(chalk.cyan(message)); }; diff --git a/lib/transport/index.js b/lib/transport/index.js index 52f1f12..234123f 100644 --- a/lib/transport/index.js +++ b/lib/transport/index.js @@ -306,6 +306,7 @@ Transport.prototype.prompt = (function() { return this.waitFor(function(done) { Queue.push(function() { + prompt.colors = false; prompt.delimiter = ''; prompt.message = chalk.gray(self._context.remote.host); prompt.start();