supports-color-cli
Advanced tools
Comparing version 1.1.0 to 2.0.0
40
cli.js
#!/usr/bin/env node | ||
'use strict'; | ||
var meow = require('meow'); | ||
var supportsColor = require('supports-color'); | ||
const meow = require('meow'); | ||
const supportsColor = require('supports-color'); | ||
var cli = meow({ | ||
help: [ | ||
'Usage', | ||
' $ supports-color [--<256|16m>]', | ||
'', | ||
'Options', | ||
' --256 Check for 256 color support', | ||
' --16m Check for 16 million color support (True Color)', | ||
'', | ||
'Examples', | ||
' $ supports-color', | ||
' $ supports-color --256', | ||
' $ supports-color --16m', | ||
'', | ||
'Exits with code 0 if color is supported and 1 if not' | ||
] | ||
}); | ||
const cli = meow(` | ||
Usage | ||
$ supports-color | ||
var flags = cli.flags; | ||
var level = flags['256'] ? 'has256' : flags['16m'] ? 'has16m' : 'hasBasic'; | ||
Options | ||
--256 Check for 256 color support | ||
--16m Check for 16 million color support | ||
Examples | ||
$ supports-color | ||
$ supports-color --256 | ||
$ supports-color --16m | ||
Exits with code 0 if color is supported and 1 if not | ||
`); | ||
const flags = cli.flags; | ||
const level = flags['256'] ? 'has256' : flags['16m'] ? 'has16m' : 'hasBasic'; | ||
process.exit(supportsColor[level] ? 0 : 1); |
{ | ||
"name": "supports-color-cli", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Detect whether a terminal supports color", | ||
@@ -12,7 +12,2 @@ "license": "MIT", | ||
}, | ||
"maintainers": [ | ||
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)", | ||
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)", | ||
"JD Ballard <i.am.qix@gmail.com> (github.com/qix-)" | ||
], | ||
"bin": { | ||
@@ -22,6 +17,6 @@ "supports-color": "cli.js" | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "node test.js" | ||
"test": "xo && ava" | ||
}, | ||
@@ -53,8 +48,10 @@ "files": [ | ||
"dependencies": { | ||
"meow": "^3.3.0", | ||
"supports-color": "^3.0.0" | ||
"meow": "^3.7.0", | ||
"supports-color": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "0.0.4" | ||
"ava": "*", | ||
"execa": "^0.7.0", | ||
"xo": "*" | ||
} | ||
} |
@@ -19,7 +19,7 @@ # supports-color-cli [![Build Status](https://travis-ci.org/chalk/supports-color-cli.svg?branch=master)](https://travis-ci.org/chalk/supports-color-cli) | ||
Usage | ||
$ supports-color [--<256|16m>] | ||
$ supports-color | ||
Options | ||
--256 Check for 256 color support | ||
--16m Check for 16 million color support (True Color) | ||
--256 Check for 256 color support | ||
--16m Check for 16 million color support | ||
@@ -34,5 +34,3 @@ Examples | ||
You can force color by setting the environment variable `FORCE_COLOR` to any value. | ||
## Related | ||
@@ -43,4 +41,10 @@ | ||
## Maintainers | ||
- [Sindre Sorhus](https://github.com/sindresorhus) | ||
- [Josh Junon](https://github.com/qix-) | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48
3399
3
19
+ Addedhas-flag@2.0.0(transitive)
+ Addedsupports-color@4.5.0(transitive)
- Removedhas-flag@1.0.0(transitive)
- Removedsupports-color@3.2.3(transitive)
Updatedmeow@^3.7.0
Updatedsupports-color@^4.1.0