diff options
author | Rebecca Turner <me@re-becca.org> | 2015-07-24 10:57:45 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-07-24 12:33:43 +0300 |
commit | 8733bff1835749c2e6ed7b5a2df48490294f8c27 (patch) | |
tree | 6936112b2485e270f8e0a19d0154d59dbcdae124 /node_modules/supports-color | |
parent | 230943ceb7c38365bcf4c6e78b9e30e2c949fd9b (diff) |
supports-color@2.0.0
Diffstat (limited to 'node_modules/supports-color')
-rwxr-xr-x | node_modules/supports-color/cli.js | 29 | ||||
-rw-r--r-- | node_modules/supports-color/index.js | 21 | ||||
-rw-r--r-- | node_modules/supports-color/package.json | 42 | ||||
-rw-r--r-- | node_modules/supports-color/readme.md | 18 |
4 files changed, 36 insertions, 74 deletions
diff --git a/node_modules/supports-color/cli.js b/node_modules/supports-color/cli.js deleted file mode 100755 index e74698766..000000000 --- a/node_modules/supports-color/cli.js +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node -'use strict'; -var pkg = require('./package.json'); -var supportsColor = require('./'); -var argv = process.argv.slice(2); - -function help() { - console.log([ - '', - ' ' + pkg.description, - '', - ' Usage', - ' supports-color', - '', - ' Exits with code 0 if color is supported and 1 if not' - ].join('\n')); -} - -if (argv.indexOf('--help') !== -1) { - help(); - return; -} - -if (argv.indexOf('--version') !== -1) { - console.log(pkg.version); - return; -} - -process.exit(supportsColor ? 0 : 1); diff --git a/node_modules/supports-color/index.js b/node_modules/supports-color/index.js index a17196485..4346e272e 100644 --- a/node_modules/supports-color/index.js +++ b/node_modules/supports-color/index.js @@ -1,21 +1,28 @@ 'use strict'; var argv = process.argv; +var terminator = argv.indexOf('--'); +var hasFlag = function (flag) { + flag = '--' + flag; + var pos = argv.indexOf(flag); + return pos !== -1 && (terminator !== -1 ? pos < terminator : true); +}; + module.exports = (function () { if ('FORCE_COLOR' in process.env) { return true; } - if (argv.indexOf('--no-color') !== -1 || - argv.indexOf('--no-colors') !== -1 || - argv.indexOf('--color=false') !== -1) { + if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { return false; } - if (argv.indexOf('--color') !== -1 || - argv.indexOf('--colors') !== -1 || - argv.indexOf('--color=true') !== -1 || - argv.indexOf('--color=always') !== -1) { + if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { return true; } diff --git a/node_modules/supports-color/package.json b/node_modules/supports-color/package.json index 81f5ebdb5..020a57ea5 100644 --- a/node_modules/supports-color/package.json +++ b/node_modules/supports-color/package.json @@ -1,47 +1,44 @@ { "_args": [ [ - "supports-color@^1.3.0", + "supports-color@^2.0.0", "/Users/rebecca/code/npm/node_modules/chalk" ] ], - "_from": "supports-color@>=1.3.0 <2.0.0", - "_id": "supports-color@1.3.1", + "_from": "supports-color@>=2.0.0 <3.0.0", + "_id": "supports-color@2.0.0", "_inCache": true, "_location": "/supports-color", - "_nodeVersion": "0.12.0", + "_nodeVersion": "0.12.5", "_npmUser": { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, - "_npmVersion": "2.5.1", + "_npmVersion": "2.11.2", "_phantomChildren": {}, "_requested": { "name": "supports-color", - "raw": "supports-color@^1.3.0", - "rawSpec": "^1.3.0", + "raw": "supports-color@^2.0.0", + "rawSpec": "^2.0.0", "scope": null, - "spec": ">=1.3.0 <2.0.0", + "spec": ">=2.0.0 <3.0.0", "type": "range" }, "_requiredBy": [ "/chalk" ], - "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", - "_shasum": "15758df09d8ff3b4acc307539fabe27095e1042d", + "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "_shasum": "535d045ce6b6363fa40117084629995e9df324c7", "_shrinkwrap": null, - "_spec": "supports-color@^1.3.0", + "_spec": "supports-color@^2.0.0", "_where": "/Users/rebecca/code/npm/node_modules/chalk", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", "url": "sindresorhus.com" }, - "bin": { - "supports-color": "cli.js" - }, "bugs": { - "url": "https://github.com/sindresorhus/supports-color/issues" + "url": "https://github.com/chalk/supports-color/issues" }, "dependencies": {}, "description": "Detect whether a terminal supports color", @@ -51,25 +48,22 @@ }, "directories": {}, "dist": { - "shasum": "15758df09d8ff3b4acc307539fabe27095e1042d", - "tarball": "http://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz" + "shasum": "535d045ce6b6363fa40117084629995e9df324c7", + "tarball": "http://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" }, "engines": { "node": ">=0.8.0" }, "files": [ - "cli.js", "index.js" ], - "gitHead": "09f1b4c336cee7269b4c8b3a8880054a23fcb35e", - "homepage": "https://github.com/sindresorhus/supports-color", + "gitHead": "8400d98ade32b2adffd50902c06d9e725a5c6588", + "homepage": "https://github.com/chalk/supports-color", "keywords": [ "256", "ansi", - "bin", "capability", "cli", - "cli", "color", "colors", "colour", @@ -100,10 +94,10 @@ "optionalDependencies": {}, "repository": { "type": "git", - "url": "https://github.com/sindresorhus/supports-color" + "url": "https://github.com/chalk/supports-color" }, "scripts": { "test": "mocha" }, - "version": "1.3.1" + "version": "2.0.0" } diff --git a/node_modules/supports-color/readme.md b/node_modules/supports-color/readme.md index fe6016f9d..b4761f1ec 100644 --- a/node_modules/supports-color/readme.md +++ b/node_modules/supports-color/readme.md @@ -1,4 +1,4 @@ -# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color) +# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color) > Detect whether a terminal supports color @@ -25,20 +25,10 @@ It obeys the `--color` and `--no-color` CLI flags. For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`. -## CLI +## Related -``` -$ npm install --global supports-color -``` - -``` -$ supports-color --help - - Usage - supports-color - - Exits with code 0 if color is supported and 1 if not -``` +- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right ## License |