Merge pull request #78 from sindresorhus/no-colors

Make it possible to disable colors
This commit is contained in:
billy gates
2012-10-16 23:13:20 -07:00
2 changed files with 7 additions and 0 deletions

View File

@@ -50,6 +50,8 @@ To search for packages:
To list all the available packages, just call `bower search` without specifying a name.
You can disable colors by using the `--no-color` flag.
### Defining a package
You can create a `component.json` file in your project's root, specifying all of its dependencies. This is similar to Node's `package.json`, or Ruby's `Gemfile`, and is useful for locking down a project's dependencies.

View File

@@ -9,8 +9,13 @@
var colors = require('colors');
var hogan = require('hogan.js');
var _ = require('lodash');
var nopt = require('nopt');
module.exports = hogan.Template.prototype.renderWithColors = function (context, partials, indent) {
if (nopt(process.argv).color === false) {
colors.mode = 'none';
}
context = _.extend({
yellow : function (s) { return s.yellow; },
green : function (s) { return s.green; },