mirror of
https://github.com/bower/bower.git
synced 2026-02-11 14:34:58 -05:00
Fix error render, CS.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
var mout = require('mout');
|
||||
|
||||
var colorful;
|
||||
var colorless;
|
||||
var paddings = {
|
||||
tag: 10,
|
||||
tagPlusLabel: 31
|
||||
};
|
||||
|
||||
var tagColors = {
|
||||
'warn': 'yellow',
|
||||
'error': 'red',
|
||||
@@ -22,9 +23,9 @@ function renderError(err) {
|
||||
var str;
|
||||
|
||||
err.level = 'error';
|
||||
err.tag = err.code;
|
||||
err.tag = 'error';
|
||||
|
||||
str = 'bower ' + renderTagPlusLabel(err) + ' ' + err.message + '\n';
|
||||
str = 'bower ' + renderTagPlusLabel(err) + ' ' + (err.code ? err.code + ' ,' : '') + err.message + '\n';
|
||||
|
||||
// Check if additional details were provided
|
||||
if (err.details) {
|
||||
@@ -89,19 +90,22 @@ function renderTagPlusLabel(data) {
|
||||
|
||||
// -------------------------
|
||||
|
||||
module.exports.colorful = {};
|
||||
module.exports.colorful.head = empty;
|
||||
module.exports.colorful.tail = empty;
|
||||
|
||||
module.exports.colorful.data = renderData;
|
||||
module.exports.colorful.error = renderError;
|
||||
module.exports.colorful.end = renderEnd;
|
||||
module.exports.colorful.checkout = renderCheckout;
|
||||
colorful = {
|
||||
head: empty,
|
||||
tail: empty,
|
||||
data: renderData,
|
||||
error: renderError,
|
||||
end: renderEnd,
|
||||
checkout: renderCheckout
|
||||
};
|
||||
|
||||
// The colorless variant simply removes the colors from the colorful methods
|
||||
module.exports.colorless = mout.object.map(module.exports.colorful, function (fn) {
|
||||
colorless = mout.object.map(module.exports.colorful, function (fn) {
|
||||
return function () {
|
||||
var str = fn.apply(fn, arguments);
|
||||
return uncolor(str);
|
||||
};
|
||||
});
|
||||
|
||||
module.exports.colorful = colorful;
|
||||
module.exports.colorless = colorless;
|
||||
|
||||
Reference in New Issue
Block a user