Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Make it possible to disable colors #78

Merged
merged 1 commit into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 5, 2012
  1. @sindresorhus

    Make it possible to disable colors

    sindresorhus authored
    Fixes #76
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +2 −0  README.md
  2. +5 −0 lib/util/hogan-colors.js
View
2  README.md
@@ -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
5 lib/util/hogan-colors.js
@@ -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 },
Something went wrong with that request. Please try again.