Minor CS fixes.

This commit is contained in:
André Cruz
2013-05-24 23:03:19 +01:00
parent 784d458e62
commit 01d8d0dbec
16 changed files with 55 additions and 52 deletions

View File

@@ -47,7 +47,7 @@ function renderTagPlusLabel(data) {
// -------------------------
var colorful = {
colorful = {
begin: function () {},
end: function () {},
error: function (err) {
@@ -66,13 +66,10 @@ var colorful = {
this._write(process.stderr, str);
},
data: function (data) {
var outputStream;
data.data = data.data || '';
var outputStream = process.stdout;
if (data.level === 'warn') {
outputStream = process.stderr;
}
outputStream = data.level === 'warn' ? process.stderr : process.stdout;
this._write(outputStream, 'bower ' + renderTagPlusLabel(data) + ' ' + data.data + '\n');
},
@@ -83,15 +80,15 @@ var colorful = {
this.data(data);
},
_write: function (channel, str) {
channel.write(str);
_write: function (outputStream, str) {
outputStream.write(str);
}
};
// The colorless variant simply removes the colors from the write method
var colorless = mout.object.mixIn({}, colorful, {
_write: function (channel, str) {
channel.write(uncolor(str));
colorless = mout.object.mixIn({}, colorful, {
_write: function (outputStream, str) {
outputStream.write(uncolor(str));
}
});

View File

@@ -1,3 +1,6 @@
var json;
var nrData = 0;
function uncolor(str) {
return str.replace(/\x1B\[\d+m/g, '');
}
@@ -8,11 +11,9 @@ function stringify(data) {
// -------------------------
var nrData = 0;
// In the json output, everything goes to stderr except
// the final command result that goes to stdout.
var json = {
json = {
begin: function () {
process.stderr.write('[');
},

View File

@@ -1,8 +1,10 @@
var silent;
function empty() {}
// -------------------------
var silent = {
silent = {
begin: empty,
end: empty,
error: empty,