mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Revert "Ability to disable colors with the --no-colors arg."
This reverts commit 008e0d8c8a.
This commit is contained in:
@@ -65,8 +65,6 @@ module.exports.line = function (argv) {
|
||||
var options = nopt(optionTypes, shorthand, argv);
|
||||
var pkgs = options.argv.remain.slice(1);
|
||||
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
if (options.help) return help('cache-clean');
|
||||
return module.exports(pkgs, options);
|
||||
};
|
||||
|
||||
@@ -31,8 +31,5 @@ module.exports = function (name) {
|
||||
module.exports.line = function (argv) {
|
||||
var options = nopt({}, {}, argv);
|
||||
var paths = options.argv.remain.slice(1);
|
||||
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
return module.exports(paths[0]);
|
||||
};
|
||||
@@ -32,8 +32,6 @@ module.exports.line = function (argv) {
|
||||
var options = nopt(optionTypes, shorthand, argv);
|
||||
var names = options.argv.remain.slice(1);
|
||||
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
if (options.help || !names.length) return help('info');
|
||||
|
||||
module.exports(names[0])
|
||||
|
||||
@@ -11,15 +11,14 @@
|
||||
// 3. Throw if deps conflict
|
||||
// ==========================================
|
||||
|
||||
var Emitter = require('events').EventEmitter;
|
||||
var async = require('async');
|
||||
var nopt = require('nopt');
|
||||
var Emitter = require('events').EventEmitter;
|
||||
var async = require('async');
|
||||
var nopt = require('nopt');
|
||||
|
||||
var Manager = require('../core/manager');
|
||||
var save = require('../util/save');
|
||||
var list = require('./list');
|
||||
var help = require('./help');
|
||||
var template = require('../util/template');
|
||||
var Manager = require('../core/manager');
|
||||
var save = require('../util/save');
|
||||
var list = require('./list');
|
||||
var help = require('./help');
|
||||
|
||||
var optionTypes = { help: Boolean, force: Boolean };
|
||||
var shorthand = { 'h': ['--help'], 'S': ['--save'], 'f': ['--force'] };
|
||||
@@ -43,8 +42,6 @@ module.exports.line = function (argv) {
|
||||
var options = nopt(optionTypes, shorthand, argv);
|
||||
var paths = options.argv.remain.slice(1);
|
||||
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
if (options.help) return help('install');
|
||||
return module.exports(paths, options);
|
||||
};
|
||||
|
||||
@@ -176,9 +176,6 @@ module.exports = function (options) {
|
||||
|
||||
module.exports.line = function (argv) {
|
||||
var options = nopt(optionTypes, shorthand, argv);
|
||||
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
if (options.help) return help('list');
|
||||
return module.exports(options);
|
||||
};
|
||||
@@ -44,8 +44,6 @@ module.exports.line = function (argv) {
|
||||
var options = nopt(optionTypes, shorthand, argv);
|
||||
var names = options.argv.remain.slice(1);
|
||||
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
if (options.help || !names.length) return help('lookup');
|
||||
return module.exports(names[0]);
|
||||
};
|
||||
@@ -33,8 +33,6 @@ module.exports.line = function (argv) {
|
||||
var options = nopt(optionTypes, shorthand, argv);
|
||||
var args = options.argv.remain.slice(1);
|
||||
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
if (options.help || args.length != 2) return help('register');
|
||||
return module.exports(args[0], args[1]);
|
||||
};
|
||||
@@ -44,8 +44,6 @@ module.exports.line = function (argv) {
|
||||
var options = nopt(optionTypes, shorthand, argv);
|
||||
var names = options.argv.remain.slice(1);
|
||||
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
if (options.help) return help('search');
|
||||
return module.exports(names[0]);
|
||||
};
|
||||
@@ -75,8 +75,6 @@ module.exports = function (names, options) {
|
||||
module.exports.line = function (argv) {
|
||||
var options = nopt(optionTypes, shorthand, argv);
|
||||
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
if (options.help) return help('uninstall');
|
||||
var names = options.argv.remain.slice(1);
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ var _ = require('lodash');
|
||||
var Manager = require('../core/manager');
|
||||
var install = require('./install');
|
||||
var help = require('./help');
|
||||
var template = require('../util/template');
|
||||
|
||||
var shorthand = { 'h': ['--help'] };
|
||||
var optionTypes = { help: Boolean };
|
||||
@@ -54,8 +53,6 @@ module.exports = function (argv, options) {
|
||||
|
||||
module.exports.line = function (argv) {
|
||||
var options = nopt(optionTypes, shorthand, argv);
|
||||
if (options.colors != null) template.showColors(options.colors);
|
||||
|
||||
if (options.help) return help('update');
|
||||
|
||||
var paths = options.argv.remain.slice(1);
|
||||
|
||||
@@ -10,9 +10,7 @@ var colors = require('colors');
|
||||
var hogan = require('hogan.js');
|
||||
var _ = require('lodash');
|
||||
|
||||
var selfReturn = function (s) { return s; };
|
||||
|
||||
hogan.Template.prototype.renderWithColors = function (context, partials, indent) {
|
||||
module.exports = hogan.Template.prototype.renderWithColors = function (context, partials, indent) {
|
||||
context = _.extend({
|
||||
yellow : function (s) { return s.yellow; },
|
||||
green : function (s) { return s.green; },
|
||||
@@ -21,17 +19,4 @@ hogan.Template.prototype.renderWithColors = function (context, partials, indent)
|
||||
red : function (s) { return s.red; }
|
||||
}, context);
|
||||
return this.ri([context], partials || {}, indent);
|
||||
};
|
||||
|
||||
hogan.Template.prototype.renderWithoutColors = function (context, partials, indent) {
|
||||
context = _.extend({
|
||||
yellow : selfReturn,
|
||||
green : selfReturn,
|
||||
cyan : selfReturn,
|
||||
grey : selfReturn,
|
||||
red : selfReturn
|
||||
}, context);
|
||||
return this.ri([context], partials || {}, indent);
|
||||
};
|
||||
|
||||
module.exports = hogan.Template.prototype;
|
||||
};
|
||||
@@ -14,7 +14,6 @@ var fs = require('fs');
|
||||
var colors = require('../util/hogan-colors');
|
||||
|
||||
var templates = {};
|
||||
var printColors = true;
|
||||
|
||||
module.exports = function (name, context, sync) {
|
||||
var emitter = new events.EventEmitter;
|
||||
@@ -22,25 +21,19 @@ module.exports = function (name, context, sync) {
|
||||
var templateName = name + '.mustache';
|
||||
var templatePath = path.join(__dirname, '../../templates/', templateName);
|
||||
|
||||
var renderFunc = printColors ? 'renderWithColors' : 'renderWithoutColors';
|
||||
|
||||
if (sync) {
|
||||
if (!templates[templatePath]) templates[templatePath] = fs.readFileSync(templatePath, 'utf-8');
|
||||
return hogan.compile(templates[templatePath])[renderFunc](context);
|
||||
return hogan.compile(templates[templatePath]).renderWithColors(context);
|
||||
} else if (templates[templatePath]) {
|
||||
process.nextTick(function () {
|
||||
emitter.emit('data', hogan.compile(templates[templatePath])[renderFunc](context));
|
||||
emitter.emit('data', hogan.compile(templates[templatePath]).renderWithColors(context));
|
||||
});
|
||||
} else {
|
||||
fs.readFile(templatePath, 'utf-8', function (err, file) {
|
||||
templates[templatePath] = file;
|
||||
emitter.emit('data', hogan.compile(file)[renderFunc](context));
|
||||
emitter.emit('data', hogan.compile(file).renderWithColors(context));
|
||||
});
|
||||
}
|
||||
|
||||
return emitter;
|
||||
};
|
||||
|
||||
module.exports.showColors = function (show) {
|
||||
printColors = !!show;
|
||||
};
|
||||
Reference in New Issue
Block a user